private void ChangeImpact(AttackInstructions instructions, string impactName, bool isEffectEnabled) { if (isEffectEnabled) { instructions.AddImpact(impactName); } else { instructions.RemoveImpact(impactName); } this.SetAttackSummaryText(); }
public void ChangeCenterTarget(object state) { DefenderAttackInstructions dins = state as DefenderAttackInstructions; if (dins.IsAttackCenter) { AttackInstructions ins = this.AttackInstructionsCollection.FirstOrDefault(ai => ai.Defender == dins.Defender); ins.IsCenterOfAreaEffectAttack = true; foreach (AttackInstructions ai in this.AttackInstructionsCollection.Where(instr => instr != ins)) { ai.IsCenterOfAreaEffectAttack = false; } } }
public void AddAsAttackTarget(AttackInstructions instructions) { if (instructions is MultiAttackInstructions) { //(instructions as MultiAttackInstructions).AddTarget() //AreaAttackInstructions areaAttackInstructions = instructions as AreaAttackInstructions; //if(areaAttackInstructions.IndividualTargetInstructions.FirstOrDefault(iti => iti.Defender == this) == null) //{ // areaAttackInstructions.IndividualTargetInstructions.Add( // new AttackInstructionsImpl // { // Defender = this // }); //} } else { instructions.Defender = this; } }
private void SetDefenderInstructions() { this.DefenderAttackInstructions = new ObservableCollection <DefenderAttackInstructions>(); if (CurrentAttackInstructions is MultiAttackInstructions) { MultiAttackInstructions multiAttackInstructions = CurrentAttackInstructions as MultiAttackInstructions; this.AttackInstructionsCollection = multiAttackInstructions.IndividualTargetInstructions; foreach (var defender in multiAttackInstructions.Defenders) { DefenderAttackInstructions defenderAttackInstructions = new DefenderAttackInstructions(); defenderAttackInstructions.Defender = defender; defenderAttackInstructions.AttackerHitInfo = new ObservableCollection <AttackerHitInfo>(); if (this.Attackers.Count > 1) { defenderAttackInstructions.HasMultipleAttackers = true; } foreach (var attacker in this.Attackers) { AttackInstructions instructionForAttacker = multiAttackInstructions.IndividualTargetInstructions.FirstOrDefault(i => i.Defender == defender && i.Attacker == attacker); defenderAttackInstructions.AttackerHitInfo.Add(new AttackerHitInfo { Attacker = attacker, AttackInstructionsForAttacker = instructionForAttacker }); } this.DefenderAttackInstructions.Add(defenderAttackInstructions); } } else { this.AttackInstructionsCollection = new ObservableCollection <AttackInstructions> { CurrentAttackInstructions }; DefenderAttackInstructions defenderAttackInstructions = new DefenderAttackInstructions(); defenderAttackInstructions.Defender = CurrentAttackInstructions.Defender; defenderAttackInstructions.AttackerHitInfo = new ObservableCollection <AttackerHitInfo>(); defenderAttackInstructions.AttackerHitInfo.Add(new AttackerHitInfo { AttackInstructionsForAttacker = CurrentAttackInstructions }); this.DefenderAttackInstructions.Add(defenderAttackInstructions); } foreach (var obst in CurrentAttackInstructions.Obstacles.Where(o => o.ObstacleTarget is AnimatedCharacter)) { DefenderAttackInstructions defenderAttackInstructions = new DefenderAttackInstructions(); defenderAttackInstructions.Defender = obst.ObstacleTarget as AnimatedCharacter; defenderAttackInstructions.AttackerHitInfo = new ObservableCollection <AttackerHitInfo>(); defenderAttackInstructions.AttackerHitInfo.Add(new AttackerHitInfo { AttackInstructionsForAttacker = obst.ObstacleInstructions }); this.DefenderAttackInstructions.Add(defenderAttackInstructions); } foreach (var dai in this.DefenderAttackInstructions) { dai.PropertyChanged += DefenderAttackInstructions_PropertyChanged; } }
public CancelAttackEvent(AnimatedAttack attackToExecute, List <AnimatedCharacter> attackers, AttackInstructions instructions) { this.AttackToExecute = attackToExecute; this.Attackers = attackers; this.AttackInstructions = instructions; }
public ConfigureAttackEvent(AnimatedAttack attackToConfigure, List <AnimatedCharacter> attackers, AttackInstructions instructions) { this.AttackToConfigure = attackToConfigure; this.Attackers = attackers; this.AttackInstructions = instructions; }
public AttackStartedEvent(AnimatedCharacter attacker, AttackInstructions instructions) { this.Attacker = attacker; this.AttackInstructions = instructions; }