public static void Assassinate(TroopScript Assassin, TroopScript Victim) { int AssassinChance = Mathf.RoundToInt(((float)Assassin.GetEnergy()/(float)Assassin.GetMaxEnergy())*900+((float)Assassin.GetNumber()/(float)Assassin.GetmaxNumber())*100); int VictimChance = Mathf.RoundToInt(((float)Victim.GetEnergy()/(float)Victim.GetMaxEnergy())*100+((float)Victim.GetNumber()/(float)Victim.GetmaxNumber())*900); if (AssassinChance>VictimChance && Victim.boss == false) Victim.SetNumber(0); }
public void SummonYogurt(Vector2 Position, TroopScript MageThatCreatedIt) { ThirdParty Ogre = ((GameObject)Instantiate(OgrePrefab, new Vector3(Position.x - Mathf.Floor((float)mapSize/2),1.5f, -Position.y + Mathf.Floor((float)mapSize/2)), Quaternion.Euler(new Vector3()))).GetComponent<ThirdParty>(); Ogre.gridPosition = Position; Chief myLeader = new Chief(); Chief summoner = MageThatCreatedIt.GetChief(); AddStuffToChief(myLeader, "Ogre", "McPrettyFace", Trait.FromTraitList(ListOfTraits.Fearless),Abilities.fromList(ListOfAbilities.StrongLeadership),Abilities.fromList(ListOfAbilities.Popular),Abilities.fromList(ListOfAbilities.Phalanx), summoner.GetIntelligence(),summoner.GetIntelligence(),0,summoner.GetSpeed()); int OgreHP = MageThatCreatedIt.GetChief().GetIntelligence()*MageThatCreatedIt.GetNumber()/2; //can be changed in the future AddStuffToPlayer(Ogre,2,muhClasses.Yogurt,myLeader, 0, 10,100,12,OgreHP,Weaponry.FromName(WeaponryName.TestHammer),Armory.FromName(ArmoryName.TestConfortableClothes)); Ogre.Summoner = MageThatCreatedIt; // AITroop aiplayer = ((GameObject)Instantiate(AITroopPrefab, new Vector3(6 - Mathf.Floor(mapSize/2),1.5f, -4 + Mathf.Floor(mapSize/2)), Quaternion.Euler(new Vector3()))).GetComponent<AITroop>(); // aiplayer.gridPosition = new Vector2(6,4); // leader = new Chief(); // AddStuffToChief(leader,"another asshole","Obama", Trait.FromTraitList(ListOfTraits.Fearless),Abilities.fromList(ListOfAbilities.StrongLeadership),Abilities.fromList(ListOfAbilities.Popular),Abilities.fromList(ListOfAbilities.Phalanx),2,3,1,3); // // AddStuffToPlayer(aiplayer,1,muhClasses.Animal,leader, 12,2,100,12,100,Weaponry.FromName(WeaponryName.TestHammer),Armory.FromName(ArmoryName.TestConfortableClothes)); // // players.Add(aiplayer); }
public void CreateIcewall(Vector2 Position, TroopScript MageThatCreatedIt) { ThirdParty iceicebaby = ((GameObject)Instantiate(IcePrefab, new Vector3(Position.x - Mathf.Floor((float)mapSize/2),1.5f, -Position.y + Mathf.Floor((float)mapSize/2)), Quaternion.Euler(new Vector3()))).GetComponent<ThirdParty>(); Chief Proprietary = new Chief(); AddStuffToChief(Proprietary, "Ice", "Wall", Trait.FromTraitList(ListOfTraits.Fearless),Abilities.fromList(ListOfAbilities.StrongLeadership),Abilities.fromList(ListOfAbilities.Popular),Abilities.fromList(ListOfAbilities.Phalanx),0,0,0,0); Debug.Log (Proprietary); int IceHP = MageThatCreatedIt.GetChief().GetIntelligence()*MageThatCreatedIt.GetNumber()/2; //can be changed in the future iceicebaby.SetBaseTurnSpeed(0); AddStuffToPlayer(iceicebaby,2,muhClasses.Ice,Proprietary, 0, 10,100,12,IceHP,Weaponry.FromName(WeaponryName.TestHammer),Armory.FromName(ArmoryName.TestConfortableClothes)); players.Add(iceicebaby); Debug.Log(iceicebaby); iceicebaby.gridPosition = Position; iceicebaby.Summoner = MageThatCreatedIt; // AITroop aiplayer = ((GameObject)Instantiate(AITroopPrefab, new Vector3(6 - Mathf.Floor(mapSize/2),1.5f, -4 + Mathf.Floor(mapSize/2)), Quaternion.Euler(new Vector3()))).GetComponent<AITroop>(); // aiplayer.gridPosition = new Vector2(6,4); // leader = new Chief(); // AddStuffToChief(leader,"another asshole","Obama", Trait.FromTraitList(ListOfTraits.Fearless),Abilities.fromList(ListOfAbilities.StrongLeadership),Abilities.fromList(ListOfAbilities.Popular),Abilities.fromList(ListOfAbilities.Phalanx),2,3,1,3); // // AddStuffToPlayer(aiplayer,1,muhClasses.Animal,leader, 12,2,100,12,100,Weaponry.FromName(WeaponryName.TestHammer),Armory.FromName(ArmoryName.TestConfortableClothes)); // // players.Add(aiplayer); }
static int CountAndSetNumberOfPeopleYouCanBuff(TroopScript BuffCaster, TroopScript Target, Skill BuffSkill) { float multiply = BuffSkill.TroopSizeBuffMultiplier; int people = BuffCaster.GetNumber(); int buffedpeople = Target.GetNumber(); int total = Mathf.RoundToInt(((float)people*multiply/(float)buffedpeople)+multiply); return total; //for the list of buffs }
static void RatingFromDamage(TroopScript Caster, int Damage) { int value = Mathf.RoundToInt( (Damage / (float)Caster.GetNumber())*5); GameManager.instance.SetAdvantage (Caster,value); }
static int CalculateCounterDamage(TroopScript Attacker, TroopScript Defender, float CounterAtkScale, int BattlefieldEffect) { int AdjustedTroopSize= CalculateAdjustedTroopSize ( Attacker.GetNumber(),ReturnPeoplePerLine(Attacker),Attacker.GetChief().GetMuhReturns()); int TroopDamage = 0; if (Attacker.GetClass().GetIfItsPhysical()) TroopDamage = Mathf.RoundToInt ((AdjustedTroopSize*((float)CalculateAttack(Attacker.GetClass().GetAttack(),Attacker.GetChief().GetAttack(),Attacker.GetCounterAttackBuff())-(float)CalculateDefense(Defender.GetClass().GetDefense(),Defender.GetChief().GetDefense(),Defender.GetDefenseBuff(),Defender.GetPhalanx()))/15)); else TroopDamage = Mathf.RoundToInt((AdjustedTroopSize*(((float)CalculateMagicAttack(Attacker.GetClass().GetIntelligence(),Attacker.GetChief().GetIntelligence(),Attacker.GetCounterMatkBuff())-(float)CalculateMagicDefense(Defender.GetChief().GetIntelligence(),Defender.GetMdefBuff()))/15))); if (TroopDamage>Attacker.GetNumber()) TroopDamage = Attacker.GetNumber(); int flatWeaponValue = Attacker.GetWeapon().Attack*((Attacker.GetClass().GetIfItsPhysical()&&Attacker.GetWeapon().physical||!Attacker.GetWeapon().physical&&!Attacker.GetClass().GetIfItsPhysical())?1:0); int Final = Mathf.RoundToInt(((TroopDamage*Attacker.GetWeapon().AttackModifier+flatWeaponValue)*CounterAtkScale)*BattlefieldEffect); return Final; }
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; }
public static void MonkSelfHeal(TroopScript Monk, float SkillModifier) { int TroopSize = CalculateAdjustedTroopSize(Monk.GetNumber(),ReturnPeoplePerLine(Monk),Monk.GetChief().GetMuhReturns()); int Heal = HealAmount (TroopSize,Monk.GetChief().GetIntelligence(),SkillModifier,0); //MUH BUFFEADOS Monk.SetNumber(Monk.GetNumber()+Heal); if (Monk.GetNumber()>Monk.GetmaxNumber()) Monk.SetNumber(Monk.GetmaxNumber()); }
static int CalculateAccurateShotDamage(TroopScript Attacker, TroopScript Defender, float _skillDamage, int BattlefieldEffect) { int AdjustedTroopSize = CalculateAdjustedTroopSize (Attacker.GetNumber(),ReturnPeoplePerLine(Attacker), Attacker.GetChief().GetMuhReturns()); int TroopDamage = Mathf.RoundToInt ((AdjustedTroopSize*((float)CalculateAttack(Attacker.GetClass().GetAttack(),Attacker.GetChief().GetAttack(),Attacker.GetDirectAttackBuff())-(float)CalculateDefense(Defender.GetClass().GetDefense(),Defender.GetChief().GetDefense(),Defender.GetDefenseBuff()))/15)); int flatWeaponValue = Attacker.GetWeapon().Attack; int Final = Mathf.RoundToInt(((TroopDamage*Attacker.GetWeapon().AttackModifier+flatWeaponValue)*_skillDamage)*BattlefieldEffect); return Final; }
public static void KnightCharge(TroopScript Caster,TroopScript Target) { float DamageScaling = 1.5f; if (Caster.GetNumber()<Target.GetNumber()) DamageScaling = 3; Skill KnightCharge = Skill.FromListOfSkills(muhSkills.KnightCharge); KnightCharge.DamageScaling = DamageScaling; MeleeFightingScript(Caster,Target,KnightCharge); }
public static void MeleeFightingScript(TroopScript Attacker, TroopScript Defender, Skill SkillUsed) { int AttackerBattlefieldEffect = 1; //still to impement int DefenderBattlefieldEffect = 1; //still to impement int DamageOnAtk = 0; int DamageOnDef = 0; TroopScript DefenderGuarder = Defender.GuardedBy; float DefenderGuardPercent = (float)Defender.GuardedByPercent/100; if (SkillUsed.CancelsPreparation == true && Defender.isMagicGuarded == false){ Defender.CancelPreparation(); Defender.FlushPreparationTarget(); } if (SkillUsed.ReducesEnergy == true && Defender.isMagicGuarded == false){ Defender.SetEnergy(Defender.GetEnergy()-1); if (Defender.GetEnergy() <0) Defender.SetEnergy(0); } if (SkillUsed.RemoveBuffs == true && Defender.isMagicGuarded == false)Defender.RemoveAllbuffs(); if (SkillUsed.AppliesPoison == true && Defender.Poisoned == 0) Defender.Poisoned = 1; if (SkillUsed.Freezes == true && !Defender.Frozen) Defender.Frozen = true; if (SkillUsed.Penetrating == true || DefenderGuarder == null){ DamageOnDef = CalculateDamage(Attacker,Defender,SkillUsed,AttackerBattlefieldEffect); Debug.Log("Damage on "+Defender.GetChief().GetName()+":"+DamageOnDef); Defender.SetNumber(Defender.GetNumber()-DamageOnDef); if (Defender.GetNumber()<0) Defender.SetNumber(0); if (CanCounter(Attacker,Defender,SkillUsed)){ float CounterScaling = CounterAttackDamage(Defender.GetChief().GetCounterAttack(),Defender.GetArmor().CounterAttackValue+Defender.GetWeapon().CounterAttackValue); DamageOnAtk = CalculateCounterDamage(Defender,Attacker,CounterScaling,DefenderBattlefieldEffect); Attacker.SetNumber(Attacker.GetNumber()-DamageOnAtk); if (Attacker.GetNumber()<0) Attacker.SetNumber(0);}} else if (SkillUsed.Penetrating == false && DefenderGuarder != null){ DamageOnDef = CalculateDamage(Attacker,Defender,SkillUsed,AttackerBattlefieldEffect); if (SkillUsed.AffectRating) RatingFromDamage(Attacker,DamageOnDef); if (DefenderGuarder){ if (DefenderGuarder.GetNumber()<= 0){ Defender.GuardedBy = null; Defender.GuardedByPercent = 0; DamageOnDef = CalculateDamage(Attacker,Defender,SkillUsed,AttackerBattlefieldEffect); Debug.Log("Damage on "+Defender.GetChief().GetName()+":"+DamageOnDef); Defender.SetNumber(Defender.GetNumber()-DamageOnDef); if (Defender.GetNumber()<0) Defender.SetNumber(0); if (CanCounter(Attacker,Defender,SkillUsed)){ float CounterScaling = CounterAttackDamage(Defender.GetChief().GetCounterAttack(),Defender.GetArmor().CounterAttackValue+Defender.GetWeapon().CounterAttackValue); DamageOnAtk = CalculateCounterDamage(Defender,Attacker,CounterScaling,DefenderBattlefieldEffect); Attacker.SetNumber(Attacker.GetNumber()-DamageOnAtk); if (Attacker.GetNumber()<0) Attacker.SetNumber(0);} }else{ DefenderGuarder.SetNumber(DefenderGuarder.GetNumber()-Mathf.RoundToInt(DamageOnDef*DefenderGuardPercent)); if (DefenderGuarder.GetNumber()<0) DefenderGuarder.SetNumber(0); Defender.SetNumber(Defender.GetNumber()-Mathf.RoundToInt(DamageOnDef*(1-DefenderGuardPercent))); if (Defender.GetNumber()<0) Defender.SetNumber(0); if (CanCounter(Attacker,DefenderGuarder,SkillUsed)){ float CounterScaling = CounterAttackDamage(DefenderGuarder.GetChief().GetCounterAttack(),DefenderGuarder.GetArmor().CounterAttackValue+DefenderGuarder.GetWeapon().CounterAttackValue); DamageOnAtk = CalculateCounterDamage(DefenderGuarder,Attacker,CounterScaling,DefenderBattlefieldEffect); Attacker.SetNumber(Attacker.GetNumber()-DamageOnAtk); if (Attacker.GetNumber()<0) Attacker.SetNumber(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()); }
public static void FinisherDamageScaling(TroopScript Caster, TroopScript Target) { float CasterHpPercent = (float)Caster.GetNumber()/Caster.GetmaxNumber(); float TargetHpPercent = (float)Target.GetNumber()/Target.GetmaxNumber(); float SkillScaling = .5f*(CasterHpPercent/TargetHpPercent); }
public static float DamageScalingRevenge(TroopScript Caster) { float value; float hpPercent = (float)Caster.GetNumber()/(float)Caster.GetmaxNumber(); value = 0.7f*(1/hpPercent); //need to change this return value; }
public static float DamageScalingCleanUp(TroopScript Caster, TroopScript Target) { float value; float HpDifferences = ((float)Caster.GetNumber()/(float)Caster.GetmaxNumber())/((float)Caster.GetNumber()/(float)Caster.GetmaxNumber()); value = -1f+Mathf.Pow(1.5f,HpDifferences); return value; }
// //atkbuffmodifier needs a method. first you need to check your ATKONLY COUNTERONLY buffs and then decide the final modifier // static int FinalDamage (int BaseAttack, int CptAttack, int AtkBuffModifier, int BaseDefense, int CptDefense, int DefBuffModifier, // int TroopSize, float WeaponModifier, int FlatWeapon, bool FlatWeaponPhysical, float SkillModifier, float BattlefieldEffect, // int PeoplePerLine, float CptAbility, bool isPhysical, int BaseIntAtk, int IntCptDef, int IntCpt,float MatkBuffModifier,float MdefBuffModifier){ // int AdjustedTroopSize = CalculateAdjustedTroopSize (TroopSize,PeoplePerLine,CptAbility); // int TroopDamage = 0; // Debug.Log("is physical:" +isPhysical); // if (isPhysical) // TroopDamage = Mathf.RoundToInt ((AdjustedTroopSize*((float)CalculateAttack(BaseAttack,CptAttack,AtkBuffModifier)-(float)CalculateDefense(BaseDefense,CptDefense,DefBuffModifier))/15)); // else if (!isPhysical) // TroopDamage = Mathf.RoundToInt((AdjustedTroopSize*(((float)CalculateMagicAttack(BaseIntAtk,IntCpt,MatkBuffModifier)-(float)CalculateMagicDefense(IntCptDef,MdefBuffModifier))/15))); // Debug.Log("troop dmg"+TroopDamage); // if (TroopDamage> TroopSize) // TroopDamage = TroopSize; // // int FlatWeaponValue = 0; // FlatWeaponValue = FlatWeapon*((isPhysical&&FlatWeaponPhysical||!isPhysical&&!FlatWeaponPhysical)?1:0); // Debug.Log("weap:" +WeaponModifier); // int Final = Mathf.RoundToInt(((TroopDamage*WeaponModifier+FlatWeaponValue)*SkillModifier)*BattlefieldEffect); // // return Final; // } public static float CalculateMaimRatio(TroopScript Caster, TroopScript Target) { int cpeople = CalculateAdjustedTroopSize(Caster.GetNumber(),ReturnPeoplePerLine(Caster),Caster.GetChief().GetMuhReturns()); int tpeople = CalculateAdjustedTroopSize(Target.GetNumber(),ReturnPeoplePerLine(Target),Target.GetChief().GetMuhReturns()); float ratio = (tpeople/cpeople)*0.75f; return ratio; }