public disable(string s, int dur, FBG_Pokemon tar, string atkName) { name = s; duration = dur; target = tar; tMove = atkName; }
//.. public static void changeStats(string type, int stageMod, FBG_Pokemon target) { if (target.team.hasMist && stageMod < 0) { return; } int newStage = getStatStage(type, target); newStage += stageMod; if (newStage > 6) newStage = 6; if (newStage < -6) newStage = -6; setStatStage(type, newStage, target); if (type == FBG_consts.accuracy || type == FBG_consts.evasion) { return; } float multiplier = stageToMultiplier_BaseStat(newStage); target.updateStatStage(type, multiplier); }
/// <summary> /// This method takes the name of the attack and then passes it into other methods in the Attack_Switch_Case to get the effect /// of the attack on the enemy or player pokemon, if it is a status type of attack or one that deals damage or stuns...ect. /// </summary> public static MoveResults calculateAttackEffect(FBG_Pokemon tar, FBG_Pokemon self, string atkName) { MoveResults MR = new MoveResults(); move_DmgReport report = new move_DmgReport(); targetPokemon = tar; thisPokemon = self; if(thisPokemon.nextAttack != "") { atkName = thisPokemon.nextAttack; } Debug.LogWarning(string.Format(" {0} is using {1} on {2} ", self.Name, atkName, tar.Name)); int atkIndex = getAttackListIndex(atkName); string atkCat = FBG_Atk_Data.attackList[atkIndex].cat; string atkType = FBG_Atk_Data.attackList[atkIndex].type; int accuracy = FBG_Atk_Data.attackList[atkIndex].accuracy; float baseDamage = calculateDamage(atkName, atkCat, atkIndex); //Debug.Log("Base Damage: " + baseDamage); //this also sets our crit bool in the move results float dmgMod = modifier(atkName, atkType, MR); baseDamage = Mathf.Round(baseDamage * dmgMod); //Debug.Log("Damage: " + baseDamage); if (atkCat != FBG_consts.Status) { MR.hit = checkAccuracy_and_Hit(self, tar, atkName, accuracy); } //Debug.Log("Attack Name: " + attack_name); FBG_Atk_Switch.setPokemon(tar, self, MR); switch (atkCat) { case FBG_consts.Status: Debug.Log("Status Move"); report = FBG_Atk_Switch.statusAttacks(atkName); break; case FBG_consts.Physical: Debug.Log("Physical Move"); report = FBG_Atk_Switch.physicalAttacks(atkName, baseDamage); break; case FBG_consts.Special: Debug.Log("Special Move"); report = FBG_Atk_Switch.specialAttacks(atkName, baseDamage); break; } MR.dmgReport = report; if(self.atkStatus != attackStatus.normal) { MR.dmgReport.damage = 0; } //Debug.Log("Final Damage " + MR.dmgReport.damage); return MR; }
//.. public static void conversion(FBG_Pokemon self) { //tempList = genAttacks.get_playerAttackName(); //string tempName = tempList[0]; string name = self.atkMoves[0]; int attack_index = FBG_Atk_Calc.getAttackListIndex(name); string attack_type = FBG_Atk_Data.attackList[attack_index].type; self.type1 = attack_type; string[] types = new string[2]; types[0] = self.type1; types[1] = self.type2; self.damageMultiplier = FBG_DmgMult.createMultiplier(types); }
/// <summary> /// this is only to check if this affects the pokemon moving /// </summary> /// <param name="self">the pokemon to check</param> /// <returns></returns> private static bool checkPlayerNVStatus(FBG_Pokemon self) { if (self.status_A != nonVolitileStatusEffects.none) { if (self.status_A == nonVolitileStatusEffects.paralized) { int rnd = UnityEngine.Random.Range(1, 4); if (rnd == 1) { string text = self.Name + " is Paralized!"; //c_Queue.AddCoroutineToQueue(DisplayText(text)); return true; } } if (self.status_A == nonVolitileStatusEffects.sleep) { self.nonVolDuration--; string text = ""; if (self.nonVolDuration == 0) { text = self.Name + " woke up!"; //c_Queue.AddCoroutineToQueue(DisplayText(text)); } else { text = self.Name + " is fast asleep!"; //c_Queue.AddCoroutineToQueue(DisplayText(text)); return true; } } if (self.status_A == nonVolitileStatusEffects.frozen) { int rnd = UnityEngine.Random.Range(1, 10); if (rnd >= 2) { string text = self.Name + " is Frozen!"; //c_Queue.AddCoroutineToQueue(DisplayText(text)); return true; } else { self.status_A = nonVolitileStatusEffects.none; string text = self.Name + " thawed out!"; //c_Queue.AddCoroutineToQueue(DisplayText(text)); } } } return false; }
public static float ChargingMove(FBG_Pokemon self, string atkName, float dmg) { if (self.atkStatus == attackStatus.normal) { self.cachedDamage = dmg; self.atkStatus = attackStatus.charging; self.nextAttack = "razor wind"; dmg = 0; } else if (self.atkStatus == attackStatus.charging) { self.atkStatus = attackStatus.normal; dmg = self.cachedDamage; self.cachedDamage = 0; } return dmg; }
public static void substitute(FBG_Pokemon target, MoveResults mr) { mr.dmgReport.recoil = Mathf.Round(target.maxHP / 4f); target.hasSubstitute = true; //subsitute health = mr.dmg.recoil }
public static float sonicBoom(FBG_Pokemon target) { FBG_Atk_Switch.ignoreLightScreen = true; if (checkTypes(target, FBG_consts.Ghost)) { return 0; } else { return 20f; } }
public repeatAttack_Confused(string s, int dur, FBG_Pokemon tar) { name = s; duration = dur; target = tar; }
public static float ReChargeMove(FBG_Pokemon self, string atkName, float dmg) { if (self.atkStatus == attackStatus.normal) { self.atkStatus = attackStatus.recharging; self.nextAttack = "hyper beam"; } else if (self.atkStatus == attackStatus.recharging) { self.atkStatus = attackStatus.normal; dmg = 0; } return dmg; }
//Non-volatile status effects /// <summary> /// Burns a pokemon if their Type A status is none and they aren't a fire type /// </summary> /// <param name="isPlayer">who is attacking</param> /// <param name="prob">the probability of being hit</param> /// <param name="duration">duration of the effect</param> public static void isBurned(FBG_Pokemon target, float prob) { if (!Chance_100(prob)) return; if (checkTypes(target, FBG_consts.Fire)) return; if (target.status_A == nonVolitileStatusEffects.none) { target.status_A = nonVolitileStatusEffects.burned; } }
/// <summary> /// Applies a poision to the pokemon if they aren't steel or posion type and have no other status effects /// </summary> /// <param name="isPlayer"></param> /// <param name="prob"></param> public static void isPosioned(FBG_Pokemon target, float prob) { if (!Chance_100(prob)) return; if (checkTypes(target, FBG_consts.Steel, FBG_consts.Poison)) return; if (target.status_A == nonVolitileStatusEffects.none) { target.status_A = nonVolitileStatusEffects.poisioned; } }
//done for acc and evasion private static int getStatStage(string type, FBG_Pokemon target) { int statStage = 0; switch (type) { case "attack": statStage = target.attack_Stage; break; case "spAttack": statStage = target.spAttack_Stage; break; case "defense": statStage = target.defense_Stage; break; case "spDefense": statStage = target.spDefense_stage; break; case "speed": statStage = target.speed_stage; break; case "accuracy": statStage = target.acc_stage; break; case "evasion": statStage = target.evasive_stage; break; default: Debug.Log("no type " + type + " found"); break; } return statStage; }
//I need to add gender to the FBG_Pokemon before I can implement this public static void isInfatuated(FBG_Pokemon target, FBG_Pokemon self, float prob) { if (!Chance_100(prob)) return; if (target.status_B == volitileStatusEffects.none) { target.status_B = volitileStatusEffects.infatuated; } }
/// <summary> /// Paralizes a Pokemon if they have no other status effects and aren't an electric type /// </summary> /// <param name="isPlayer">is the player attacking</param> /// <param name="prob">probability of landing this effect</param> public static void isParalized(FBG_Pokemon target, float prob) { if (!Chance_100(prob)) return; if (checkTypes(target, FBG_consts.Electric)) return; if (target.status_A == nonVolitileStatusEffects.none) { target.status_A = nonVolitileStatusEffects.paralized; changeStats(FBG_consts.speed, -6, target); } }
/// <summary> /// Freezes a Pokemon if they arent an ice type and dont have any other type A status effects /// </summary> /// <param name="isPlayer">is the player attacking</param> /// <param name="prob">probability of getting frozen</param> public static void isFrozen(FBG_Pokemon target, float prob) { if (!Chance_100(prob)) return; if (checkTypes(target, FBG_consts.Ice)) return; if (target.status_A == nonVolitileStatusEffects.none) { target.status_A = nonVolitileStatusEffects.frozen; } }
//Other public static void isFlinched(FBG_Pokemon target, float prob) { if (!Chance_100(prob)) return; target.isFlinched = true; }
//.. Status B public static void isConfused(FBG_Pokemon target, float prob, int duration) { if (!Chance_100(prob)) return; if (target.status_B == volitileStatusEffects.none) { target.status_B = volitileStatusEffects.confused; } }
/// <summary> /// Applying toxic to a pokemon if they arent either steel or a poison type pokemon and have no other status effects /// </summary> /// <param name="isPlayer">is the player attacking</param> public static void toxic(FBG_Pokemon target) { if (checkTypes(target, FBG_consts.Steel, FBG_consts.Poison)) return; if (target.status_A == nonVolitileStatusEffects.none) { target.status_A = nonVolitileStatusEffects.toxic; } }
public static float dreamEater(FBG_Pokemon target, float predictedDamage, MoveResults mr) { if (target.status_A == nonVolitileStatusEffects.sleep) { mr.dmgReport.heal = Mathf.Round(predictedDamage / 2f); } else { predictedDamage = 0; } return predictedDamage; }
/// <summary> /// Checks the type of the target pokemon against all of the strings passes in, checks both type1 and type2 /// </summary> /// <param name="target">target pokemon</param> /// <param name="s"> types to check as strings</param> /// <returns></returns> private static bool checkTypes(FBG_Pokemon target, params string[] s) { for (int i = 0; i < s.Length; i++) { if (target.type1 == s[i] || target.type2 == s[i]) { return true; } } return false; }
public static float earthQuake(FBG_Pokemon target, float predictedDamage) { if (target.position == pokemonPosition.underground) { return Mathf.Round(predictedDamage * 2); } return predictedDamage; }
private static void setStatStage(string type, int newStage, FBG_Pokemon target) { switch (type) { case FBG_consts.attack: target.attack_Stage = newStage; break; case FBG_consts.spAttack: target.spAttack_Stage = newStage; break; case FBG_consts.defense: target.defense_Stage = newStage; break; case FBG_consts.spDefense: target.spDefense_stage = newStage; break; case FBG_consts.speed: target.speed_stage = newStage; break; case FBG_consts.accuracy: target.acc_stage = newStage; break; case FBG_consts.evasion: target.evasive_stage = newStage; break; default: Debug.LogError("no type " + type + " found"); break; } }
public rage(string s, int dur, FBG_Pokemon tar) { name = s; duration = dur; target = tar; }
/// <summary> /// Puts the pokemon to sleep if they have no other status effect on them /// </summary> /// <param name="isPlayer">is the player attacking</param> /// <param name="prob">probability of it hitting</param> /// <param name="duration">duration pokemon is asleep for</param> public static void isSleep(FBG_Pokemon target, float prob, int duration) { if (!Chance_100(prob)) return; if (target.status_A == nonVolitileStatusEffects.none) { target.nonVolDuration = duration; target.status_A = nonVolitileStatusEffects.toxic; } }
public static bool hasEffector(FBG_Pokemon target, string eName) { for (int i = 0; i < target.effectors.Count; i++) { if (target.effectors[i].name == eName) { return true; } } return false; }
/// <summary> /// This method takes in the acuracy of the pokemon and calculates if it hits or not and returns a boolean /// value based on if it hits /// <param name="accuracy">the accuracy of the move being passed in</param> /// <returns>true if the move hit, false if it missed</returns> /// </summary> private static bool checkAccuracy_and_Hit(FBG_Pokemon self, FBG_Pokemon tar,string atkName, int accuracy) { //honestly double check the status of moves if(accuracy == 0) { Debug.Log("Has 0 accuracy: " + atkName); return true; } float accStage = self.acc_stage; float accMod = accStage + 3f; if(accStage >= 1) { accMod *= 100; accMod /= 3f; } else { accMod = 300f / accMod; } float evadeStage = tar.evasive_stage; float evadeMod = evadeStage + 3; if(evadeStage >= 1) { evadeMod = 300f / evadeMod; }else { evadeMod *= 100; evadeMod /= 3f; } float probability = (accuracy) * (accMod /evadeMod); if (ignoreAcc_Evade(atkName)) { probability = accuracy; } if(probability >= 100) { return true; } Debug.Log(string.Format("move acc {0} self acc {1} target evasion {2} total probability {3} * {4} = {5}", accuracy, accMod, evadeMod, (accuracy), (accMod/evadeMod), probability)); return FBG_Atk_Methods.Chance_100(probability); }
public static float levelBasedDamage(FBG_Pokemon target) { FBG_Atk_Switch.ignoreLightScreen = true; FBG_Atk_Switch.ignoreReflect = true; float damage = target.Level; return damage; }
public static void setPokemon(FBG_Pokemon tar, FBG_Pokemon s, MoveResults mr) { target = tar; self = s; moveRes = mr; damage = 0; heal = 0; recoil = 0; stageName = ""; stageDiff = 0; s.nextAttack = ""; ignoreReflect = ignoreLightScreen = false; }
public static float oneHitKO(FBG_Pokemon target, FBG_Pokemon self, MoveResults mr) { FBG_Atk_Switch.ignoreLightScreen = true; FBG_Atk_Switch.ignoreReflect = true; int acc = target.Level - self.Level + 30; if (Chance_100(acc)) { return target.maxHP; } mr.hit = false; return 0; }