public int Attack(BattlerType t, iBattleable target) { int totalDamage = 0; if (t == BattlerType.Instigator) { totalDamage = _instigatorBattlers.Sum(x => x.GetStrength()); Audio.AudioInstance.PlaySFX(_instigatorBattlers[0].GetAttackSound()); } else { totalDamage = _oppositionBattler.GetStrength(); Audio.AudioInstance.PlaySFX(_oppositionBattler.GetAttackSound()); } target.ReduceHP(totalDamage); OnBattleAbleTakeDamage(target, totalDamage); OnBattleAbleUpdate(target); if (target.IsKO()) { Audio.AudioInstance.PlaySFX(target.GetDeathSound()); } else { Audio.AudioInstance.PlaySFX(target.GetHitSound()); } Debug.Log(t + " attacked " + target.GetType() + " for " + totalDamage + " damage."); Debug.Log(target.GetCurrentHP() + " hp left (" + target.GetHPPercentage() * 100 + "%)"); return(totalDamage); }
void BattleManager_OnBattleAbleTakeDamage(iBattleable battleAbleObject, int i) { //Animator a = if (battleAbleObject.IsKO()) { } }
IEnumerator endTurn() { if (!(activePlayer == BattlerType.Opposition && _BattleData._BattleType != BattleType.PvP)) { // do end turn stuff _BattleUnitPositionManager._ArmyUI.Hide(); _BattleUnitPositionManager._HandUI.Hide(); _BattleUnitPositionManager._ButtonsUI.Hide(); } yield return(new WaitForSeconds(2)); if (_instigatorBattlers.Count() == 0) { _endBattle(BattleEndState.Loss); } else if (_oppositionBattler.IsKO()) { if (_BattleData._BattleType == BattleType.LostImmortal) { if (_oppositionReserveB != null) { _BattleUnitPositionManager.RemoveOpposition(); _BattleUnitPositionManager.SetReserveBAsOpposition(); _oppositionBattler = _oppositionReserveB; _oppositionReserveB = null; switchPlayer(); } else if (_oppositionReserveC != null) { _BattleUnitPositionManager.RemoveOpposition(); _BattleUnitPositionManager.SetReserveCAsOpposition(); _oppositionBattler = _oppositionReserveC; _oppositionReserveC = null; switchPlayer(); } else { _BattleUnitPositionManager.RemoveOpposition(); _endBattle(BattleEndState.Win); } } else { _BattleUnitPositionManager.RemoveOpposition(); _endBattle(BattleEndState.Win); } } else { switchPlayer(); } }
public int Attack(BattlerType t, iBattleable target) { int totalDamage = 0; if (t == BattlerType.Instigator) { totalDamage = _instigatorBattlers.Sum(x => x.GetStrength()); Audio.AudioInstance.PlaySFX(_instigatorBattlers[0].GetAttackSound()); } else { totalDamage = _oppositionBattler.GetStrength(); Audio.AudioInstance.PlaySFX(_oppositionBattler.GetAttackSound()); } target.ReduceHP(totalDamage); OnBattleAbleTakeDamage (target, totalDamage); OnBattleAbleUpdate (target); if (target.IsKO()) { Audio.AudioInstance.PlaySFX(target.GetDeathSound()); } else { Audio.AudioInstance.PlaySFX(target.GetHitSound()); } Debug.Log(t + " attacked " + target.GetType() + " for " + totalDamage + " damage."); Debug.Log(target.GetCurrentHP() + " hp left (" + target.GetHPPercentage()*100 + "%)"); return totalDamage; }