package characters; import enums.CharacterType; import java.util.List; public class Child extends Character { String thoughts = ""; public Child(String name) { super(CharacterType.CHILD, name); } // Child can listen to stories about the city and ask questions about the subject of the story public void think(String story) { if (story.contains("город")) { this.thoughts += "Я никогда не был в городе, но история о " + context.getStoryContext() + " мне очень понравилась\n"; } else if (story.contains("путешествие")) { this.thoughts += "Не люблю я путешествовать, но история о " + context.getStoryContext() + " мне очень понравилась\n"; } else { this.thoughts += "Интересная получается история о " + context.getStoryContext() + "\n"; } } public String converse(String subject) { String response = this.name + " слушает историю о " + context.getStoryContext() + " и спрашивает вопросы о " + subject; this.thoughts = ""; return response; } @Override public String listen(String subject) { String response = this.name + " слушает историю о " + context.getStoryContext() + " и спрашивает вопросы о " + subject; this.thoughts = ""; return response; } public void discussTravelers(List travelers){ System.out.println(this.name + " обсуждает путешественников: "); for(Traveler t: travelers){ if(t.isHome()){ System.out.println(t.getName()); } } } }