Exemple #1
0
        public CombatLogEntry Use(IDice dice, Combatant combatant)
        {
            combatant.AddSpellToSpellBook(Spell);
            combatant.RemoveItemFromInventory(this);

            return null;
        }
Exemple #2
0
        public CombatLogEntry Use(IDice dice, Combatant combatant)
        {
            if (!combatant.Weapon.Equals(BareHands))
            {
                combatant.AddItemToInventory(combatant.Weapon);
            }

            combatant.RemoveItemFromInventory(this);
            combatant.Weapon = this.DeepClone();
            combatant.Weapon.Quantity = 1;

            return null;
        }
        public CombatLogEntry Use(IDice dice, Combatant combatant)
        {
            var outcomes = Effects.Select(x => x.Execute(dice, combatant)).ToList();

            var logEntry = new CombatLogEntry
            {
                Attacker = combatant,
                CombatEffect = new CombatOutcome
                {
                    Healing = outcomes.Aggregate(0, (healing, outcome) => healing + outcome.Healing),
                    Damage = outcomes.Aggregate(0, (damage, outcome) => damage + outcome.Damage),
                },
                Text = string.Format(
                    "{0} used {1}.{2}{3}",
                    combatant.Name,
                    this.GetLeveledName(),
                    Environment.NewLine,
                    string.Join(Environment.NewLine, outcomes.Select(x => x.Description)))
            };

            combatant.RemoveItemFromInventory(this);

            return logEntry;
        }