public int RawDamage(BattleChar instigator, BattleChar target, AttackSkill skill) { float k = generalCoefficient * Random.Range(0.9f, 1.1f); float damage = k * LevelModifier(instigator) * STAB(instigator, skill) * StatModifier(instigator, target) * PowerModifier(skill); return(Mathf.RoundToInt(damage)); }
void UseAttackSkill(Skill skill) { AttackSkill aSkill = (AttackSkill)skill; if (aSkill._attackAll) { turn._command._targets = battle._activeParty; } else { turn._command._targets = new BattleChar[] { activeParty[Random.Range(0, activeParty.Length)] }; } }
void AttackSkill(Skill skill) { AttackSkill aSkill = (AttackSkill)skill; if (aSkill._attackAll) { turn._command._targets = battle._activeEnemies; sm.ChangeState(StateID.PlayerTurnAction); } else { turn._targets = battle._activeEnemies; sm.ChangeState(StateID.PlayerTurnTarget); } }
public AttackCommand(BattleChar instigator, AttackSkill skill) : base(instigator) { this.skill = skill; battle = game._battle; combat = game._combat; ui = game._ui; typeDatabase = game._typeDatabase; normalDelay = battle._delay; smallDelay = 0.33f * normalDelay; commandType = CommandType.Skill; }
int Damage(BattleChar instigator, BattleChar target, AttackSkill skill, float effectiveness, float critical) { if (effectiveness == 0) { return(0); } int damageCap = game._pointsCap; int damage = Mathf.RoundToInt(effectiveness * critical * combat.RawDamage(instigator, target, skill)); if (damage <= 0) { damage = 1; } if (damage > damageCap) { damage = damageCap; } return(damage); }
public bool SuccessfulHit(BattleChar instigator, BattleChar[] targets, AttackSkill skill) { float speedRatio; int threshold; int i = Random.Range(0, 100); speedRatio = (float)instigator._speed._currentStatValue / AverageSpeed(targets); if (speedRatio < 1 && speedRatio >= 0.5f) { threshold = Mathf.RoundToInt(speedRatio * skill._accuracy); } else if (speedRatio < 0.5f) { threshold = Mathf.RoundToInt(speedRatio * skill._accuracy); } else { threshold = Mathf.RoundToInt(skill._accuracy); } return(i < threshold); }
float PowerModifier(AttackSkill skill) { return(powerCoefficient * skill._power); }