示例#1
0
 static int CalculateDamage(TroopScript Attacker, TroopScript Defender, Skill Skillused, int BattlefieldEffect)
 {
     TroopScript thisGuysTerrain;
     int TroopDamage = 0;
     if (Skillused.SkillMaxRange > 1)
         thisGuysTerrain = Attacker;
     else thisGuysTerrain = Defender;
     int	AdjustedTroopSize= CalculateAdjustedTroopSize ( Attacker.GetNumber(),ReturnPeoplePerLine(thisGuysTerrain),Attacker.GetChief().GetMuhReturns());
     bool isPhysical = Skillused.isPhysical;
     if (isPhysical && Skillused.PiercesDefence == false)
     TroopDamage = Mathf.RoundToInt	((AdjustedTroopSize*((float)CalculateAttack(Attacker.GetClass().GetAttack(),Attacker.GetChief().GetAttack(),Attacker.GetDirectAttackBuff())-(float)CalculateDefense(Defender.GetClass().GetDefense(),Defender.GetChief().GetDefense(),Defender.GetDefenseBuff(),Defender.GetPhalanx()))/15));
     else if (isPhysical && Skillused.PiercesDefence == true)
         TroopDamage = Mathf.RoundToInt	((AdjustedTroopSize*((float)CalculateAttack(Attacker.GetClass().GetAttack(),Attacker.GetChief().GetAttack(),Attacker.GetDirectAttackBuff())-(float)CalculatePiercedDefense(Defender.GetClass().GetDefense(),Defender.GetChief().GetDefense(),Defender.GetDefenseBuff())/15)));
     else if (!isPhysical)
     TroopDamage = Mathf.RoundToInt((AdjustedTroopSize*(((float)CalculateMagicAttack(Attacker.GetClass().GetIntelligence(),Attacker.GetChief().GetIntelligence(),Attacker.GetDirectMatkBuff())-(float)CalculateMagicDefense(Defender.GetChief().GetIntelligence(),Defender.GetMdefBuff()))/15)));
     if (TroopDamage>Attacker.GetNumber())
         TroopDamage = Attacker.GetNumber();
     int flatWeaponValue = Attacker.GetWeapon().Attack*((isPhysical&&Attacker.GetWeapon().physical||!Attacker.GetWeapon().physical&&!isPhysical)?1:0);
     int Final = Mathf.RoundToInt(((TroopDamage*Attacker.GetWeapon().AttackModifier+flatWeaponValue)*Skillused.DamageScaling)*BattlefieldEffect);
     return Final;
 }
示例#2
0
 public static void HealingTarget(TroopScript Healer, TroopScript Healed, float SkillModifier)
 {
     int PeoplePerLine = ReturnPeoplePerLine(Healer);
     int TroopSize = CalculateAdjustedTroopSize(Healer.GetNumber(),PeoplePerLine,Healer.GetChief().GetMuhReturns());
     int Healing = HealAmount(TroopSize,Healer.GetChief().GetIntelligence(),SkillModifier,Healer.GetDirectMatkBuff()); //NEED BUFF MODIFIERS FUGG
     Healed.SetNumber(Healed.GetNumber()+Healing);
     if (Healed.GetNumber()>Healed.GetmaxNumber())
         Healed.SetNumber(Healed.GetmaxNumber());
 }