26 lines
780 B
Java
26 lines
780 B
Java
package lab14_strategy.ex1;
|
|
|
|
import lab14_strategy.ex1.characters.King;
|
|
import lab14_strategy.ex1.characters.Knight;
|
|
import lab14_strategy.ex1.characters.Troll;
|
|
import lab14_strategy.ex1.characters.Queen;
|
|
import lab14_strategy.ex1.weapons.BowAndArrowBehavior;
|
|
import lab14_strategy.ex1.weapons.KnifeBehavior;
|
|
|
|
public class Game {
|
|
public static void main(String[] args) {
|
|
Character king = new King(new KnifeBehavior());
|
|
Character queen = new Queen(new BowAndArrowBehavior());
|
|
Character knight = new Knight(new SwordBehavior());
|
|
Character troll = new Troll(new AxeBehavior());
|
|
|
|
king.fight();
|
|
queen.fight();
|
|
knight.fight();
|
|
troll.fight();
|
|
|
|
king.setWeapon(new SwordBehavior());
|
|
king.fight();
|
|
}
|
|
}
|