Ejemplo n.º 1
0
        private static CombatantModel Update(this CombatantModel combatant, World world, DateTime when)
        {
            // check for activating skills
            if (combatant.ActivatingSkill != EnumSkill.None
                && combatant.ActivatingSkillTimestamp + combatant.ActivatingSkillLeadTime <= when)
                world.UseSkillNow(
                    combatant,
                    // TODO: avoid looking it up?
                    Global.Schema.EnumSkill.FindByEnumSkillID((int)combatant.ActivatingSkill),
                    combatant.Target);

            // TODO: check for queued skills
            //else if (c.SkillQueue.Length > 0)
            //c.ActivatingSkill = c.SkillQueue.Head;

            if (combatant.Target != null)
                combatant.CheckAttack(world, when);
            else if ((when - combatant.LastMoveUpdate).TotalSeconds > 1
                && (combatant.MobileState == EnumMobileState.Running
                    || combatant.MobileState == EnumMobileState.Walking))
                // TODO: where to check if changed?, also can remove cast with generics
                combatant = (CombatantModel)combatant.WithState(EnumMobileState.Standing);

            combatant = combatant.HealUpdate(when);
            return combatant;
        }
Ejemplo n.º 2
0
 public static void CheckAttack(this CombatantModel combatant, World world, DateTime when)
 {
     if ((when - combatant.LastAttackUpdate).TotalSeconds > 3)
     {
         // TODO: don't look it up every time
         var esr = Global.Schema.EnumSkill.FindByEnumSkillID((int)EnumSkill.Kill);
         world.UseSkillNow(combatant, esr, combatant.Target);
     }
 }