public void ResolveEndTurnStatusEffect(MonBattleData monster) { switch (monster.hasStatus) { case (StatusEffect.Burn): battleDialogue.AddToMessages(string.Format("{0} took damage from it's burn.", monster.monName)); monster.TakeDamage(Mathf.FloorToInt(monster.maxHP * 0.06f)); UpdateHPBar(monster); if (monster == playerMon) { playerModel.GetComponent <Animator>().SetTrigger("Damage"); } else { enemyModel.GetComponent <Animator>().SetTrigger("Damage"); } break; case (StatusEffect.Poison): battleDialogue.AddToMessages(string.Format("{0} took damage from poison.", monster.monName)); monster.TakeDamage(Mathf.FloorToInt(monster.maxHP * 0.12f)); UpdateHPBar(monster); if (monster == playerMon) { playerModel.GetComponent <Animator>().SetTrigger("Damage"); } else { enemyModel.GetComponent <Animator>().SetTrigger("Damage"); } break; } }
public bool ResolveMidTurnStatusEffect(MonBattleData monster) { switch (monster.hasStatus) { case (StatusEffect.Sleep): monster.remainingSleepTurns -= 1; if (monster.remainingSleepTurns <= 0) { monster.remainingSleepTurns = 0; monster.HealStatus(); UpdateHPBar(monster); battleDialogue.AddToMessages(string.Format("{0} awoke from sleep!", monster.monName)); return(true); } battleDialogue.AddToMessages(string.Format("{0} is still asleep!", monster.monName)); return(false); case (StatusEffect.Paralysis): if (CheckEffectHit(50)) { return(true); } battleDialogue.AddToMessages(string.Format("{0} is fully paralyzed!", monster.monName)); return(false); case (StatusEffect.Frozen): if (CheckEffectHit(20)) { monster.HealStatus(); UpdateHPBar(monster); battleDialogue.AddToMessages(string.Format("{0} thawed out!", monster.monName)); return(true); } battleDialogue.AddToMessages(string.Format("{0} is still frozen!", monster.monName)); return(false); case (StatusEffect.Confusion): { if (CheckEffectHit(50)) { return(true); } else { int dmg = CalculateConfuseDamage(monster); monster.TakeDamage(dmg); UpdateHPBar(monster); battleDialogue.AddToMessages(string.Format("{0} hit itself in confusion for {1} damage...", monster.monName, dmg)); return(false); } } default: return(true); } }
void ResolveDamagingAttack(MoveData move, MonBattleData attacker, MonBattleData defender) { bool crit; Effectiveness effectiveness; int damage; if (attacker == playerMon) { playerModel.GetComponent <Animator>().SetTrigger("Attack"); } else { enemyModel.GetComponent <Animator>().SetTrigger("Attack"); } if (CheckIfHit(move, attacker, defender)) { crit = CheckIfCrit(move); effectiveness = defender.GetEffectiveness(move.moveType); damage = CalculateDamage(move, attacker, defender, crit); if (crit) { battleDialogue.AddToMessages("A critical hit!"); } if (effectiveness == Effectiveness.resist2x || effectiveness == Effectiveness.resist4x) { battleDialogue.AddToMessages("It's not very effective..."); } else if (effectiveness == Effectiveness.weak2x || effectiveness == Effectiveness.weak4x) { battleDialogue.AddToMessages("It's super effective!!!"); } if (effectiveness == Effectiveness.immune) { battleDialogue.AddToMessages("It had no effect..."); } defender.TakeDamage(damage); if (defender == playerMon) { playerModel.GetComponent <Animator>().SetTrigger("Damage"); } else { enemyModel.GetComponent <Animator>().SetTrigger("Damage"); } if (move.causesStatus != StatusEffect.none) { ResolveStatus(move, defender); } if (move.statToChange != MonStat.none) { if (move.affectSelf) { ResolveStatChange(move, attacker); } else { ResolveStatChange(move, defender); } } UpdateHPBar(defender); UpdateHPBar(attacker); } else { battleDialogue.AddToMessages("But it missed!"); } }