Exemplo n.º 1
0
 public CombatEventArgs(Actor attacker, Actor target)
 {
     Attacker = attacker;
     Target = target;
 }
Exemplo n.º 2
0
 public void Cancel(Actor attacker, Actor target)
 {
     if (_runtime.Operations.ContainsMember(_python, "Cancel"))
         _python.Cancel(this, attacker, target);
 }
Exemplo n.º 3
0
 public void Use(Actor attacker, Actor target)
 {
     if (_runtime.Operations.ContainsMember(_python, "Use"))
         _python.Use(this, attacker, target);
 }
Exemplo n.º 4
0
Arquivo: Item.cs Projeto: nate0001/AIR
        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;
                }
            }
        }
Exemplo n.º 5
0
        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;
        }
Exemplo n.º 6
0
 public static bool CanEquip(Actor actor, EquipmentSlot slot, Armor equipment)
 {
     return CheckRequirements(actor, equipment) && CheckSlot(slot, equipment);
 }
Exemplo n.º 7
0
 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);
 }
Exemplo n.º 8
0
 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;
 }