public PokemonMoveHitTarget(BattleHitTarget hitTarget) { pokemonUniqueID = hitTarget.pokemon.uniqueID; affectedByMove = hitTarget.affectedByMove; missed = hitTarget.missed; criticalHit = hitTarget.criticalHit; preHP = hitTarget.preHP; postHP = hitTarget.postHP; maxHP = hitTarget.pokemon.maxHP; damageDealt = hitTarget.damageDealt; effectiveness = hitTarget.effectiveness.GetTotalEffectiveness(); }
public void CloneFrom(BattleHitTarget other) { preHPPercent = other.preHPPercent; postHPPercent = other.postHPPercent; preHP = other.preHP; postHP = other.postHP; subDamage = other.subDamage; damageDealt = other.damageDealt; disguise = (other.disguise == null) ? null : other.disguise.Clone(); effectiveness = other.effectiveness.Clone(); affectedByMove = other.affectedByMove; missed = other.missed; criticalHit = other.criticalHit; fainted = other.fainted; isMoveReflected = other.isMoveReflected; destinyBondMove = other.destinyBondMove; protection = (other.protection == null) ? null : other.protection.Clone(); teamProtection = (other.teamProtection == null) ? null : other.teamProtection.Clone(); protectAbility = other.protectAbility; protectItem = other.protectItem; reflection = (other.reflection == null) ? null : other.reflection.Clone(); reflectMove = other.reflectMove; reflectAbility = other.reflectAbility; reflectItem = other.reflectItem; endure = (other.endure == null) ? null : other.endure.Clone(); sturdyPair = (other.sturdyPair == null) ? null : other.sturdyPair.Clone(); focusBand = (other.focusBand == null) ? null : other.focusBand.Clone(); surviveAbility = other.surviveAbility; surviveItem = other.surviveItem; }
public IEnumerator UseMoveAnimation( Pokemon userPokemon, string moveID, int moveHit, List <BattleHitTarget> hitTargets, List <Pokemon> missedPokemon ) { battleUI.UndrawDialogBox(); battleUI.SetPokemonHUDsActive(false); // Animate HP Loss List <Coroutine> hpRoutines = new List <Coroutine>(); for (int i = 0; i < hitTargets.Count; i++) { BattleHitTarget curTarget = hitTargets[i]; if (curTarget.affectedByMove && curTarget.damageDealt >= 0) { Coroutine cr = StartCoroutine(DealDamage( pokemon: curTarget.pokemon, preHP: curTarget.preHP, postHP: curTarget.postHP, damageDealt: curTarget.damageDealt, effectiveness: curTarget.effectiveness.GetTotalEffectiveness(), criticalHit: curTarget.criticalHit )); hpRoutines.Add(cr); } } for (int i = 0; i < hpRoutines.Count; i++) { yield return(hpRoutines[i]); } // Critical Hits / Effectiveness List <Pokemon> criticalTargets = new List <Pokemon>(); List <Pokemon> superEffTargets = new List <Pokemon>(); List <Pokemon> nveEffTargets = new List <Pokemon>(); for (int i = 0; i < hitTargets.Count; i++) { BattleHitTarget curTarget = hitTargets[i]; if (curTarget.affectedByMove) { if (curTarget.criticalHit) { criticalTargets.Add(curTarget.pokemon); } if (curTarget.effectiveness.GetTotalEffectiveness() > 1) { superEffTargets.Add(curTarget.pokemon); } else if (curTarget.effectiveness.GetTotalEffectiveness() < 1) { nveEffTargets.Add(curTarget.pokemon); } } } if (criticalTargets.Count > 0) { if (battleModel.IsSinglesBattle()) { yield return(StartCoroutine(battleUI.DrawText("A critical hit!"))); } else { string prefixTxt = "It was a critical hit on "; List <Pokemon> enemyPokemon = FilterPokemonByPerspective(criticalTargets, ViewPerspective.Enemy); if (enemyPokemon.Count > 0) { string text = prefixTxt + GetPrefix(ViewPerspective.Enemy, true) + GetPokemonNames(enemyPokemon) + "!"; yield return(StartCoroutine(battleUI.DrawText(text))); } List <Pokemon> allyPokemon = FilterPokemonByPerspective(criticalTargets, ViewPerspective.Ally); if (allyPokemon.Count > 0) { string text = prefixTxt + GetPrefix(ViewPerspective.Ally, true) + GetPokemonNames(allyPokemon) + "!"; yield return(StartCoroutine(battleUI.DrawText(text))); } List <Pokemon> playerPokemon = FilterPokemonByPerspective(criticalTargets, ViewPerspective.Player); if (playerPokemon.Count > 0) { string text = prefixTxt + GetPrefix(ViewPerspective.Player, true) + GetPokemonNames(playerPokemon) + "!"; yield return(StartCoroutine(battleUI.DrawText(text))); } } } if (superEffTargets.Count > 0) { if (battleModel.IsSinglesBattle()) { yield return(StartCoroutine(battleUI.DrawText("It was super-effective!"))); } else { string prefixTxt = "It was super-effective on "; List <Pokemon> enemyPokemon = FilterPokemonByPerspective(superEffTargets, ViewPerspective.Enemy); if (enemyPokemon.Count > 0) { string text = prefixTxt + GetPrefix(ViewPerspective.Enemy, true) + GetPokemonNames(enemyPokemon) + "!"; yield return(StartCoroutine(battleUI.DrawText(text))); } List <Pokemon> allyPokemon = FilterPokemonByPerspective(superEffTargets, ViewPerspective.Ally); if (allyPokemon.Count > 0) { string text = prefixTxt + GetPrefix(ViewPerspective.Ally, true) + GetPokemonNames(allyPokemon) + "!"; yield return(StartCoroutine(battleUI.DrawText(text))); } List <Pokemon> playerPokemon = FilterPokemonByPerspective(superEffTargets, ViewPerspective.Player); if (playerPokemon.Count > 0) { string text = prefixTxt + GetPrefix(ViewPerspective.Player, true) + GetPokemonNames(playerPokemon) + "!"; yield return(StartCoroutine(battleUI.DrawText(text))); } } } if (nveEffTargets.Count > 0) { if (battleModel.IsSinglesBattle()) { yield return(StartCoroutine(battleUI.DrawText("It was not very effective."))); } else { string prefixTxt = "It was not very effective on "; List <Pokemon> enemyPokemon = FilterPokemonByPerspective(nveEffTargets, ViewPerspective.Enemy); if (enemyPokemon.Count > 0) { string text = prefixTxt + GetPrefix(ViewPerspective.Enemy, true) + GetPokemonNames(enemyPokemon) + "."; yield return(StartCoroutine(battleUI.DrawText(text))); } List <Pokemon> allyPokemon = FilterPokemonByPerspective(nveEffTargets, ViewPerspective.Ally); if (allyPokemon.Count > 0) { string text = prefixTxt + GetPrefix(ViewPerspective.Ally, true) + GetPokemonNames(allyPokemon) + "."; yield return(StartCoroutine(battleUI.DrawText(text))); } List <Pokemon> playerPokemon = FilterPokemonByPerspective(nveEffTargets, ViewPerspective.Player); if (playerPokemon.Count > 0) { string text = prefixTxt + GetPrefix(ViewPerspective.Player, true) + GetPokemonNames(playerPokemon) + "."; yield return(StartCoroutine(battleUI.DrawText(text))); } } } }