public void Run() { var combatLogger = new CombatLogger(); var eventLogger = new EventLogger(); combatLogger.SetSuccessor(eventLogger); var warriorGosho = new Warrior("gosho", 10, combatLogger); var warriorPesho = new Warrior("pesho", 100, combatLogger); var group = new Group(); group.AddMember(warriorGosho); group.AddMember(warriorPesho); var dragon = new Dragon("SnowWhite", 200, 25, combatLogger); var executor = new CommandExecutor(); var groupTarget = new GroupTargetCommand(group, dragon); var groupAttack = new GroupAttackCommand(group); executor.ExecuteCommand(groupTarget); executor.ExecuteCommand(groupAttack); }
static void Main(string[] args) { Logger combatLog = new CombatLogger(); Logger eventLog = new EventLogger(); combatLog.SetSuccessor(eventLog); AbstractHero warrior = new Warrior("1", 10, combatLog); AbstractHero warrior2 = new Warrior("2", 20, combatLog); IObservableTarget dragon = new Dragon("3", 30, 25, combatLog); IAttackGroup group = new Group(); group.AddMember(warrior); group.AddMember(warrior2); dragon.Register(warrior); dragon.Register(warrior2); IExecutor executor = new CommandExecutor(); ICommand groupTarget = new GroupTargetCommand(group, dragon); ICommand groupAttack = new GroupAttackCommand(group); executor.ExecuteCommand(groupTarget); executor.ExecuteCommand(groupAttack); Console.WriteLine(warrior.Rewards); Console.WriteLine(warrior2.Rewards); }
static void Main(string[] args) { CombatLogger combatLogger = new CombatLogger(); EventLogger eventLogger = new EventLogger(); TargetLogger targetLogger = new TargetLogger(); combatLogger.SetSuccessor(eventLogger); eventLogger.SetSuccessor(targetLogger); IAttacker pesho = new Warrior("Pesho", 10, combatLogger); IAttacker stamat = new Warrior("Stamat", 20, combatLogger); IAttackGroup attackGroup = new AttackGroup(); attackGroup.AddMember(pesho); attackGroup.AddMember(stamat); ITarget target = new Dragon("Drago", 30, 200, combatLogger); ((ISubject)target).Register((IObserver)pesho); ((ISubject)target).Register((IObserver)stamat); IExecutor executor = new CommandExecutor(); ICommand groupTargetCommand = new GroupTargetCommand(attackGroup, target); ICommand groupAttackCommand = new GroupAttackCommand(attackGroup); executor.ExecuteCommand(groupAttackCommand); executor.ExecuteCommand(groupTargetCommand); executor.ExecuteCommand(groupAttackCommand); executor.ExecuteCommand(groupAttackCommand); }
public static void Main(string[] args) { Logger combatLog = new CombatLogger(); Logger eventLog = new EventLogger(); combatLog.SetSuccessor(eventLog); IAttackGroup group = new Group(); group.AddMember(new Warrior("Quannarin", 10, combatLog)); group.AddMember(new Warrior("Pancho", 15, combatLog)); ITarget dragon = new Dragon("Mincho", 200, 25); IExecutor executor = new CommandExecutor(); ICommand groupTarget = new GroupTargetCommand(group, dragon); ICommand attack = new GroupAttackCommand(group); }
public static void Main() { Logger combatLog = new CombatLogger(); Logger eventlog = new EventLogger(); combatLog.SetSuccessor(eventlog); IAttackGroup attackGroup = new Group(); attackGroup.AddMember(new Warrior("Gencho", 15, combatLog)); attackGroup.AddMember(new Warrior("Pesho", 25, combatLog)); ITarget dragon = new Dragon("Lamia", 200, 25, combatLog); IExecutor executor = new CommandExecutor(); ICommand groupTarget = new GroupTargetCommand(attackGroup, dragon); ICommand groupAttack = new GroupAttackCommand(attackGroup); }
static void Main(string[] args) { Logger combatLog = new CombatLogger(); Logger eventLog = new EventLogger(); combatLog.SetSuccessor(eventLog); IAttackGroup group = new Group(); group.AddMember(new Warrior("Torsten", 10, combatLog)); group.AddMember(new Warrior("Rolo", 15, combatLog)); ITarget dragon = new Dragon("Transylvanian White", 200, 25, combatLog); IExecutor executor = new CommandExecutor(); ICommand groupTarget = new GroupTargetCommand(group, dragon); ICommand groupAttack = new GroupAttackCommand(group); }
public static void Main(string[] args) { var combatLogger = new CombatLogger(); var eventLogger = new EventLogger(); combatLogger.SetSuccsessor(eventLogger); var group = new Group(); group.AddMember(new Warrior("Torsten", 10, combatLogger)); group.AddMember(new Warrior("Rolo", 15, combatLogger)); var dragon = new Dragon("Transylvanian White", 200, 25, combatLogger); var executor = new CommandExecutor(); var groupTarget = new GroupTargetCommand(group, dragon); var groupAttack = new GroupAttackCommand(group); }
public static void Main() { Logger combatLogger = new CombatLogger(); Logger eventLogger = new EventLogger(); combatLogger.SetSuccessor(eventLogger); IAttackGroup group = new Group(); group.AddMember(new Warrior("gosho", 10, combatLogger)); group.AddMember(new Warrior("Rolo", 15, combatLogger)); var dragon = new Dragon("Peter", 200, 25, combatLogger); IExecutor executor = new CommandExecutor(); ICommand groupTarget = new GroupTargetCommand(group, dragon); ICommand groupAttack = new GroupAttackCommand(group); }
static void Main(string[] args) { var logChain = GenerateLogChain(); IAttackGroup group = new Group(); group.AddMember(new Warrior("Torsten", 10, logChain)); group.AddMember(new Warrior("Rolo", 15, logChain)); ITarget dragon = new Dragon("Trnasylvanian White", 200, 25, logChain); IExecutor executor = new CommandExecutor(); ICommand groupTarget = new GroupTargetCommand(group, dragon); ICommand groupAttack = new GroupAttackCommand(group); executor.ExecuteCommand(groupTarget); executor.ExecuteCommand(groupAttack); }
public static void Main() { Logger combatLogger = new CombatLogger(); Logger eventLogger = new EventLogger(); combatLogger.SetSuccessor(eventLogger); Warrior firstWarrior = new Warrior("Torsten", 10, combatLogger); Warrior secondWarrior = new Warrior("Rolo", 20, combatLogger); Dragon dragon = new Dragon("Transylvanian White", 200, 25, combatLogger); IAttackGroup group = new Group(); group.AddMember(firstWarrior); group.AddMember(secondWarrior); IExecutor executor = new CommandExecutor(); ICommand groupTarget = new GroupTargetCommand(group, dragon); ICommand groupAttack = new GroupAttackCommand(group); }
public static void Main(string[] args) { IHandler combatLogger = new CombatLogger(); IHandler eventLogger = new CombatLogger(); combatLogger.SetSuccessor(eventLogger); IAttackGroup attackGroup = new Group(); IAttacker warrior = new Warrior("gosho", 10, combatLogger); IAttacker attacker = new Warrior("atanas", 100, combatLogger); attackGroup.AddMember(warrior); attackGroup.AddMember(attacker); ITarget dragon = new Dragon("Peter", 100, 25, combatLogger); IExecutor executor = new CommandExecutor(); ICommand command = new TargetCommand(warrior, dragon); ICommand attack = new AttackCommand(warrior); ICommand groupTargetCommand = new GroupTargetCommand(attackGroup, dragon); ICommand groupAttackCommand = new GroupAttackCommand(attackGroup); }
public static void Main() { Logger combatLog = new CombatLogger(); Logger eventLog = new EventLogger(); combatLog.SetSuccessor(eventLog); IAttackGroup attackGroup = new Group(); attackGroup.AddMember(new Warrior("Pesho", 10, combatLog)); attackGroup.AddMember(new Warrior("Gosho", 20, combatLog)); var dragon = new Dragon("Blue-Eyed White Dragon", 100, 25, combatLog); IExecutor executor = new CommandExecutor(); ICommand groupTarget = new GroupTargetCommand(attackGroup, dragon); groupTarget.Execute(); ICommand groupAttack = new GroupAttackCommand(attackGroup); groupAttack.Execute(); }