/// <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 battleHistory( string name, string atkName, MoveResults mr) { pokemonName = name; attackName = atkName; MR = mr; attacks move = FBG_Atk_Data.searchAttackList(atkName); atkType = move.type; atkCategory = move.cat; }
public void redTeamAttack(int index) { string atkName = redTeam[redIndex].atkMoves[index]; if (atkName == "") { return; } //print(atkName); redResult = FBG_Atk_Calc.calculateAttackEffect(blueTeam[blueIndex], redTeam[redIndex], atkName); string pName = redTeam[redIndex].Name; battleHistory hist = new battleHistory(pName, atkName, redResult); moveHistory.Add(hist); }
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; }
/// <summary> /// Sets the multiplier Base Power * STAB * Type modifier * Critical * other * randomNum(.85,1) /// <param name="atkIndex">the index of the move in the attack list</param> /// <param name="attackType">the attack type of the move being passed in</param> /// <param name="isPlayer">a boolean to see if the player is using the move or the enemy</param> /// <param name="atkName">the name of the move being passed in</param> /// <returns>the final value of all the modifiers</returns> /// </summary> private static float modifier(string atkName, string attackType, MoveResults mr) { float modifier; float stab = 1f; if (isStab(attackType)) { stab = 1.5f; } float critical = 1f; int critProb = critChance(atkName); //Debug.Log("Crit chance: 1 /" + critProb); bool crit = isCrit(critProb); mr.crit = crit; if (crit) { Debug.Log("Critical HIT!"); critical = 1.5f; } float rnd = UnityEngine.Random.Range(.85f, 1f); float typeMultiplier = fetchDmgMultModifier(attackType); if (typeMultiplier == 0) { Debug.Log("The pokemon is immune to " + attackType); return 0; } else if (typeMultiplier < 1) { Debug.Log("The move was not very effective"); } else if (typeMultiplier > 1) { Debug.LogWarning("The move is super effective"); } modifier = stab * typeMultiplier * critical * rnd; //Debug.Log("modifier = Stab: " + stab + " type multiplier: " + typeMultiplier + " critical: " + critical + " randomnum: " + rnd); //Debug.Log("modifier: " + modifier + " = Stab: " + stab + " type multiplier: " + typeMultiplier + " critical: " + critical + " randomnum: " + rnd); return modifier; }
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; }
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 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; }