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); }
static int TroopValue(TroopScript playerados) { int value = playerados.GetChief().GetAttack()+playerados.GetChief().GetDefense()+playerados.GetChief().GetIntelligence()+playerados.GetChief().GetSpeed(); return value; }
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 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; }
static int CalculateGuardPercent(TroopScript Caster, TroopScript Target, Skill SkillUsedToGuard) { int intelligence = Mathf.RoundToInt(((float)Caster.GetChief().GetIntelligence()+(float)Target.GetChief().GetIntelligence())/2); //if the one you have to guard is a retard guarding is harder int GuardScaling = SkillUsedToGuard.GuardScaling; return Mathf.RoundToInt(intelligence*GuardScaling); }
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; }
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; }
public static void PoisonStuff(TroopScript Caster, TroopScript Target, Skill SkillUsed) { if (SkillUsed.RemovesPoison) Target.Poisoned = 0; else if (SkillUsed.AppliesPoison) Target.Poisoned = Caster.GetChief().GetIntelligence(); }
static float BuffValue(TroopScript BuffCaster) { //5% buff for point of int return BuffCaster.GetChief().GetIntelligence()*0.05f; }
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()); }
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 FellowTroopRevenge (TroopScript Caster, TroopScript Target){ // int Losses = Caster.GetmaxNumber()-Caster.GetNumber(); // float Scaling = .25f*(float)Losses/((float)Caster.GetmaxNumber()/10); // Skill FellowTroopRevenge = Skill.FromListOfSkills(muhSkills.FellowTroopsRevenge); // FellowTroopRevenge.DamageScaling = Scaling; // // MeleeFightingScript(Caster,Target,FellowTroopRevenge); // } public static void FrostDiver(TroopScript Caster, TroopScript Target) { if (Target.GetChief().GetIntelligence()<Caster.GetChief().GetIntelligence()) Target.Frozen = true; MeleeFightingScript(Caster,Target,Skill.FromListOfSkills(muhSkills.FrostDiver)); }
// //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; }