public virtual bool AttackOpponent(FighterStatsClass opponent, bool CanBeDodged = true, bool ignoreTurnTime = false) { if (!CanAct() && !ignoreTurnTime) { Debug.LogWarning("Tried to attack an opponent when not allowed to do that!"); return(false); } if (!ignoreTurnTime) { currentTurnTime = 0; } if (opponent == null) { Debug.LogWarning("Fighter tried to attack an opponent that's a nnullpointer. Can't attack non-existant opponents!"); } else if (opponent.GetCurrentFighterState() == FighterState.dead) { Debug.LogWarning("Fighter tried to attack an opponent that already died. Can't attack dead opponents!"); } else { if (CanBeDodged) { float dodgeRand = 1; dodgeRand = Random.value; if (dodgeRand >= opponent.GetDodgePropability()) { opponent.ReceiveDamage(GetCurrentAttackDamage()); return(true); } else { opponent.ShowDodge(); return(false); } } else { opponent.ReceiveDamage(GetCurrentAttackDamage()); return(true); } } return(false); }