コード例 #1
0
ファイル: AttackWithWeapon.cs プロジェクト: vankos/UURRPG
        public void Execute(LivingEntity actor, LivingEntity target)
        {
            string actorString = (actor is Player) ? "You" : actor.Name;
            string targetString = (target is Player) ? "you" : target.Name.ToLower();

            if (CombatService.DoesAttackSucceeded(actor, target))
            {
                int damage = RandomNumberGenerator.GetRandNumberBetween(_minDamage, _maxDamage);

                ReportResult($"\n{actorString} deal to {targetString} {damage} hp damage");
                target.TakeDamage(damage);
            }
            else
            {
                ReportResult($"{actorString} missed {targetString}");
            }
        }