import java.util.Scanner;public class Friend extends Character{//Override and set namepublic Friend(String n){super(n);}Scanner input = new Scanner(System.in);//Override talkpublic void talk(Player p){System.out.println("Would you like to talk with " + getName() + " ?");System.out.println("(Type y for yes, type anything else for no.)");if(input.next().equals("y")){System.out.println("You have a nice talk with " + getName() + ".");p.addFriendship(1);//may need to change the numSystem.out.println("Friendship +1");}}//Override giveStuffspublic void giveStuffs(Player p){System.out.println("Would you like to give something to him?");System.out.println("(Type y for yes, type anything else for no.)");if(input.next().equals("y")){p.checkItem();//track the itemSystem.out.println("What would like to give to him?");System.out.println("(Type w, c, f, b to give. Type anything else to quit.)");String i = input.next();if(i.equals("w")&&p.getWater()>0){//remove it and add datap.removeItem("water");p.addFriendship(1);//may need to change the numSystem.out.println("\"Thank you.\"(Friendship +1)");}else if(i.equals("c")&&p.getChocolate()>0){p.removeItem("chocolate");p.addFriendship(2);System.out.println("\"Thank you.\"(Friendship +2)");}else if(i.equals("f")&&p.getFlower()>0){p.removeItem("flower");p.addFriendship(3);System.out.println("\"Ok...thank you.\"(Friendship +3)");}else if(i.equals("b")&&p.getBook()>0){p.removeItem("book");p.addFriendship(1);System.out.println("\"Thank you.\"(Friendship +1)");}else{System.out.println("You do not have that item or you type wrong.(๑°ᄆ°๑)");}//dont have the item}}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。