private bool attack(CharacterData Holder, CharacterData target) { float temp = UnityEngine.Random.value; //the character uses up stamina and mana even if the attack misses Holder.CurMP = Holder.CurMP - _ManaCost; Holder.CurStamina = Holder.CurStamina - _StaminaCost; //if the characters chance to hit and the weapons chance to hit and both less than or equal to a randomly determined value //the attack lands if (Holder.ChanceToHit >= temp && _ChanceToHit >= temp) { //generate a random number between min and max damage of this characters weapon; double dmg = UnityEngine.Random.value * (MaxDamage - MinDamage) + MinDamage; dmg *= Holder.CurStamina / GlobalConsts.STAMINA_DAMAGE_DIVIDER; target.CurHP = target.CurHP - dmg; _AttackEffect.CreateEffect(target); return(true); } return(false); }