public CombatEventArgs(Actor attacker, Actor target) { Attacker = attacker; Target = target; }
public void Cancel(Actor attacker, Actor target) { if (_runtime.Operations.ContainsMember(_python, "Cancel")) _python.Cancel(this, attacker, target); }
public void Use(Actor attacker, Actor target) { if (_runtime.Operations.ContainsMember(_python, "Use")) _python.Use(this, attacker, target); }
public void Use(Actor attacker, Actor target) { if (Usable && _runtime.Operations.ContainsMember(_python, "Use")) { if (Charges > 0 || StackSize > 0) { _python.Use(this, attacker, target); if (Stackable && 0 < StackSize) --StackSize; else if (Chargeable && 0 < Charges) --Charges; } } }
private static bool CheckRequirements(Actor actor, Armor equipment) { bool equippable = false; if (actor == null || equipment == null) return false; foreach (Requirement requirement in equipment.Requirements) { switch (requirement.Type) { case RequirementType.Ability: equippable = actor.CurrentAbilities.ContainsKey(requirement.Id); break; case RequirementType.AbilityLevel: equippable = actor.CurrentAbilities.ContainsKey(requirement.Id) && actor.CurrentAbilities[requirement.Id].Level >= requirement.Value; break; case RequirementType.Class: equippable = actor.Classes.Any(descriptor => descriptor.Id == requirement.Id); break; case RequirementType.ClassLevel: equippable = actor.Classes.Any(descriptor => descriptor.Level >= requirement.Value); break; case RequirementType.Race: equippable = actor.Race.Id == requirement.Id; break; case RequirementType.RaceLevel: equippable = actor.Race.Level >= requirement.Value; break; case RequirementType.Skill: equippable = actor.CurrentSkills.ContainsKey(requirement.Id); break; case RequirementType.SkillLevel: equippable = actor.CurrentSkills.ContainsKey(requirement.Id) && actor.CurrentSkills[requirement.Id].Level >= requirement.Value; break; case RequirementType.Stat: equippable = actor.EffectiveStats[(StatType) requirement.Id] >= requirement.Value; break; } if (!equippable) { Logger.Debug("Equipment {0} did not satisify all requirements to equip.", equipment.Id); break; } } return equippable; }
public static bool CanEquip(Actor actor, EquipmentSlot slot, Armor equipment) { return CheckRequirements(actor, equipment) && CheckSlot(slot, equipment); }
public void UseAbility(int id, Actor target) { Console.WriteLine("{0} used ability {1} on {2}", Name, CurrentAbilities[id].Name, target.Name); _events.OnAbilityUsed(new CombatEventArgs(this, target)); CurrentAbilities[id].Use(this, target); }
public void Attack(Actor target) { Console.WriteLine("{0} attacked {1}", Name, target.Name); _events.OnAttacked(new CombatEventArgs(this, target)); Console.WriteLine("{0} has done {1} damage to {2}", Name, 20, target.Name); target.EffectiveStats.Health -= 20; }