forked from mastifikator/FantasyJavaPatterns
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVisitor.java
More file actions
28 lines (23 loc) · 1.1 KB
/
Copy pathVisitor.java
File metadata and controls
28 lines (23 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package Visitor;
public class Visitor {
Present present;
String NAME = "theWiseMan";
public Visitor(Present present) {
this.present = present;
}
public void visitOrc(OrcLeader orcLeader){
System.out.println("Приветствую достопочтенный " + orcLeader.getName());
System.out.println("Я принес тебе ценный подарок!");
orcLeader.setMoney(orcLeader.getMoney() + present.getPrice());
}
public void visitHuman(HumanLeader humanLeader){
System.out.println("Приветствую благородный " + humanLeader.getName());
System.out.println("Я раскажу тебе где находится Фростморн!");
humanLeader.haveLocationFrostmourn = true;
}
public void visitNightElf(NightElfLeader nightElfLeader){
System.out.println("Приветствую лучезарная " + nightElfLeader.getName());
System.out.println("Я раскажу тебе где спрятан рог Друида!");
nightElfLeader.haveDruidHorn = true;
}
}