protected void BattleSumaryDrawSquadRight(CustomSpriteBatch g, Squad SquadRight, FormationChoices RightFormation) { int DrawX = Constants.Width - 315; int DrawY = 45; #region Leader if (RightFormation == FormationChoices.ALL) { BattleSumaryDrawLeaderRight(g, DrawX, DrawY, SquadRight.CurrentLeader, Color.FromNonPremultiplied(0x00, 0xc6, 0xff, 255)); if (SquadRight.CurrentLeader.MAPAttackAccuracyA != null) { g.DrawStringMiddleAligned(fntAccuracySmall, SquadRight.CurrentLeader.MAPAttackAccuracyA, new Vector2(DrawX + 25, DrawY + 12), Color.FromNonPremultiplied(0x00, 0xc6, 0xff, 255)); } if (SquadRight.CurrentLeader.MAPAttackAccuracyB != null) { g.DrawStringMiddleAligned(fntAccuracySmall, SquadRight.CurrentLeader.MAPAttackAccuracyB, new Vector2(DrawX + 25, DrawY + 24), Color.FromNonPremultiplied(0x00, 0xc6, 0xff, 255)); } } else { BattleSumaryDrawLeaderRight(g, DrawX, DrawY, SquadRight.CurrentLeader, Color.FromNonPremultiplied(0x00, 0xc6, 0xff, 255)); } #endregion if (SquadRight.CurrentWingmanA != null) { BattleSumaryDrawWingmanRight(g, 325, 230, SquadRight.CurrentWingmanA, Color.FromNonPremultiplied(0x00, 0xc6, 0xff, 255)); } if (SquadRight.CurrentWingmanB != null) { BattleSumaryDrawWingmanRight(g, 325, 300, SquadRight.CurrentWingmanB, Color.FromNonPremultiplied(0x00, 0xc6, 0xff, 255)); } }
public SquadBattleResult CalculateFinalHP(Squad Attacker, Squad SupportAttacker, int AttackerPlayerIndex, FormationChoices AttackerFormationChoice, Squad Defender, Squad SupportDefender, int DefenderPlayerIndex, int DefenderSquadIndex, bool ActivateSkills, bool CalculateCritical) { SquadBattleResult SquadResult = new SquadBattleResult(new BattleResult[Attacker.UnitsAliveInSquad]); Squad TargetSquad = Defender; if (SupportDefender != null) { TargetSquad = SupportDefender; } GlobalBattleContext.Result.SetTarget(-1, -1, -1, null); GlobalBattleContext.SupportAttack = null; GlobalBattleContext.SupportDefend = null; if (SupportAttacker != null) { GlobalBattleContext.SupportAttack = SupportAttacker.CurrentLeader; } if (SupportDefender != null) { GlobalBattleContext.SupportDefend = SupportDefender.CurrentLeader; } int TotalLeaderDamage = 0; if (ActivateSkills) { if (Attacker.CurrentLeader.CurrentAttack != null) { TotalLeaderDamage = GetBattleResult(Attacker.CurrentLeader, Attacker, 1, DefenderPlayerIndex, DefenderSquadIndex, 0, false, CalculateCritical).AttackDamage; } ActivateAutomaticSkills(Attacker, Attacker.CurrentLeader, DeathmatchSkillRequirement.BattleStartRequirementName, TargetSquad, TargetSquad.CurrentLeader); ActivateAutomaticSkills(TargetSquad, TargetSquad.CurrentLeader, DeathmatchSkillRequirement.BattleStartRequirementName, Attacker, Attacker.CurrentLeader); if (AttackerFormationChoice == FormationChoices.Spread) { for (int i = 1; i < Attacker.UnitsAliveInSquad && i < TargetSquad.UnitsAliveInSquad; i++) { if (Attacker[i].CurrentAttack != null) { ActivateAutomaticSkills(Attacker, Attacker[i], DeathmatchSkillRequirement.BattleStartRequirementName, TargetSquad, TargetSquad[i]); ActivateAutomaticSkills(TargetSquad, TargetSquad[i], DeathmatchSkillRequirement.BattleStartRequirementName, Attacker, Attacker[i]); } } } else if (AttackerFormationChoice == FormationChoices.Focused) { int DefenderHP = TargetSquad.CurrentLeader.HP; for (int i = 1; i < Attacker.UnitsAliveInSquad; i++) { if (Attacker[i].CurrentAttack != null && DefenderHP >= 0) { TotalLeaderDamage += GetBattleResult(Attacker[i], Attacker, WingmanDamageModifier, DefenderPlayerIndex, DefenderSquadIndex, 0, false, CalculateCritical).AttackDamage; DefenderHP = TargetSquad.CurrentLeader.ComputeRemainingHPAfterDamage(TotalLeaderDamage); ActivateAutomaticSkills(Attacker, Attacker[i], DeathmatchSkillRequirement.BattleStartRequirementName, TargetSquad, TargetSquad.CurrentLeader); ActivateAutomaticSkills(TargetSquad, TargetSquad.CurrentLeader, DeathmatchSkillRequirement.BattleStartRequirementName, Attacker, Attacker[i]); } } } else if (AttackerFormationChoice == FormationChoices.ALL) { for (int i = 1; i < TargetSquad.UnitsAliveInSquad; i++) { ActivateAutomaticSkills(Attacker, Attacker.CurrentLeader, DeathmatchSkillRequirement.BattleStartRequirementName, TargetSquad, TargetSquad[i]); ActivateAutomaticSkills(TargetSquad, TargetSquad[i], DeathmatchSkillRequirement.BattleStartRequirementName, Attacker, Attacker.CurrentLeader); } } if (SupportAttacker != null && TargetSquad.CurrentLeader.ComputeRemainingHPAfterDamage(TotalLeaderDamage) > 0) { ActivateAutomaticSkills(SupportAttacker, SupportAttacker.CurrentLeader, DeathmatchSkillRequirement.BattleStartRequirementName, TargetSquad, TargetSquad.CurrentLeader); ActivateAutomaticSkills(TargetSquad, TargetSquad.CurrentLeader, DeathmatchSkillRequirement.BattleStartRequirementName, SupportAttacker, SupportAttacker.CurrentLeader); } if (SupportDefender != null) { ActivateAutomaticSkills(SupportDefender, SupportDefender.CurrentLeader, DeathmatchSkillRequirement.BattleStartRequirementName, Attacker, null); ActivateAutomaticSkills(SupportDefender, SupportDefender.CurrentLeader, DeathmatchSkillRequirement.SupportDefendRequirementName, Attacker, null); } } if (Attacker.CurrentLeader.CurrentAttack != null) { SquadResult.ArrayResult[0] = GetBattleResult(Attacker.CurrentLeader, Attacker, 1, DefenderPlayerIndex, DefenderSquadIndex, 0, ActivateSkills, CalculateCritical); } TotalLeaderDamage = SquadResult.ArrayResult[0].AttackDamage; if (AttackerFormationChoice == FormationChoices.Spread) { for (int i = 1; i < Attacker.UnitsAliveInSquad && i < TargetSquad.UnitsAliveInSquad; i++) { if (Attacker[i].CurrentAttack != null) { SquadResult.ArrayResult[i] = GetBattleResult(Attacker[i], Attacker, WingmanDamageModifier, DefenderPlayerIndex, DefenderSquadIndex, i, ActivateSkills, CalculateCritical); } } } else if (AttackerFormationChoice == FormationChoices.Focused) { int DefenderHP = TargetSquad.CurrentLeader.HP; for (int i = 1; i < Attacker.UnitsAliveInSquad; i++) { if (Attacker[i].CurrentAttack != null && DefenderHP >= 0) { SquadResult.ArrayResult[i] = GetBattleResult(Attacker[i], Attacker, WingmanDamageModifier, DefenderPlayerIndex, DefenderSquadIndex, 0, ActivateSkills, CalculateCritical); TotalLeaderDamage += SquadResult.ArrayResult[i].AttackDamage; DefenderHP = TargetSquad.CurrentLeader.ComputeRemainingHPAfterDamage(SquadResult.ArrayResult[i].AttackDamage); } } } else if (AttackerFormationChoice == FormationChoices.ALL) { for (int i = 1; i < TargetSquad.UnitsAliveInSquad; i++) { SquadResult.ArrayResult[i] = GetBattleResult(Attacker.CurrentLeader, Attacker, 1, DefenderPlayerIndex, DefenderSquadIndex, i, ActivateSkills, CalculateCritical); } } if (SupportAttacker != null && TargetSquad.CurrentLeader.ComputeRemainingHPAfterDamage(TotalLeaderDamage) > 0) { if (ActivateSkills) { ActivateAutomaticSkills(SupportAttacker, SupportAttacker.CurrentLeader, DeathmatchSkillRequirement.BattleStartRequirementName, TargetSquad, null); ActivateAutomaticSkills(SupportAttacker, SupportAttacker.CurrentLeader, DeathmatchSkillRequirement.SupportAttackRequirementName, TargetSquad, null); } SquadResult.ResultSupportAttack = GetBattleResult(SupportAttacker.CurrentLeader, SupportAttacker, 0.75f, DefenderPlayerIndex, DefenderSquadIndex, 0, ActivateSkills, CalculateCritical); } if (ActivateSkills) { UpdateMapEvent(EventTypeOnBattle, 0); } return(SquadResult); }
protected void BattleSumaryDrawSquadLeft(CustomSpriteBatch g, Squad SquadLeft, FormationChoices LeftFormation, Squad Support) { int DrawX = 5; int DrawY = 45; bool ShowStats = ListPlayer[TargetPlayerIndex].IsPlayerControlled || SquadLeft.ListAttackedTeam.Contains(ListPlayer[ActivePlayerIndex].Team); #region Leader //Draw the hit rate %. if (LeftFormation == FormationChoices.ALL) { BattleSumaryDrawLeaderLeft(g, DrawX, DrawY, SquadLeft.CurrentLeader, Color.FromNonPremultiplied(0xff, 0x00, 0x00, 255), ShowStats); if (SquadLeft.CurrentLeader.MAPAttackAccuracyA != null) { g.DrawStringMiddleAligned(fntAccuracySmall, SquadLeft.CurrentLeader.MAPAttackAccuracyA, new Vector2(DrawX + 212, DrawY + 35), Color.FromNonPremultiplied(0x00, 0xc6, 0xff, 255)); } if (SquadLeft.CurrentLeader.MAPAttackAccuracyB != null) { g.DrawStringMiddleAligned(fntAccuracySmall, SquadLeft.CurrentLeader.MAPAttackAccuracyB, new Vector2(DrawX + 212, DrawY + 47), Color.FromNonPremultiplied(0x00, 0xc6, 0xff, 255)); } } else { BattleSumaryDrawLeaderLeft(g, DrawX, DrawY, SquadLeft.CurrentLeader, Color.FromNonPremultiplied(0xff, 0x00, 0x00, 255), ShowStats); } #endregion if (SquadLeft.CurrentWingmanA != null) { BattleSumaryDrawWingmanLeft(g, 5, 230, SquadLeft.CurrentWingmanA, Color.FromNonPremultiplied(0xff, 0x00, 0x00, 255), ShowStats); DrawBox(g, new Vector2(5, 230), 240, 65, Color.Red); DrawBox(g, new Vector2(245, 230), 70, 65, Color.Red); g.DrawString(fntFinlanderFont, SquadLeft.CurrentWingmanA.UnitStat.Name, new Vector2(15, 230 + 5), Color.White); g.DrawString(fntFinlanderFont, SquadLeft.CurrentWingmanA.HP.ToString(), new Vector2(15, 230 + 27), Color.White); } if (SquadLeft.CurrentWingmanB != null) { BattleSumaryDrawWingmanLeft(g, 5, 300, SquadLeft.CurrentWingmanB, Color.FromNonPremultiplied(0xff, 0x00, 0x00, 255), ShowStats); } if (Support != null) { DrawBox(g, new Vector2(5, 370), 240, 65, Color.Red); DrawBox(g, new Vector2(245, 370), 70, 35, Color.Red); DrawBox(g, new Vector2(245, 370 + 30), 70, 35, Color.Red); g.DrawString(fntFinlanderFont, Support.CurrentLeader.UnitStat.Name, new Vector2(15, 370 + 5), Color.White); //Support defend won't have an attack if (Support.CurrentLeader.CurrentAttack != null) { g.DrawString(fntFinlanderFont, Support.CurrentLeader.CurrentAttack.ToString(), new Vector2(15, 370 + 27), Color.White);//Draw remaining supports g.DrawStringMiddleAligned(fntFinlanderFont, Support.CurrentLeader.Boosts.SupportAttackModifier + "/" + Support.CurrentLeader.Boosts.SupportAttackModifierMax, new Vector2(280, 372), Color.FromNonPremultiplied(0xff, 0x00, 0x00, 255)); //Draw the hit rate %. g.DrawStringMiddleAligned(fntFinlanderFont, Support.CurrentLeader.AttackAccuracy, new Vector2(280, 401), Color.FromNonPremultiplied(0xff, 0x00, 0x00, 255)); } } }