Ejemplo n.º 1
0
        public void Resolve(object eventLoad)
        {
            var castLoad = (Encounter)eventLoad;

            if (castLoad.Action.GetType() != typeof(AttackAction))
            {
                return;
            }

            resolvingEncounter     = true;
            currentDefenderIsSetup = true;

            attackRecieved   = (AttackAction)castLoad.Action.Clone();
            attackerRecieved = castLoad.Attacker;
            defenderRecieved = castLoad.Defender;

            ApplyStagger(attackRecieved, attackerRecieved);
            CloneRecievedToCurrent();
            currentStep         = EncounterStep.None;
            attackRepeatCounter = 1;
        }
Ejemplo n.º 2
0
        private void _HandleStep(EncounterStep step)
        {
            // if the entity is new add to dictionary
            if (!_CurrentEntities.ContainsKey(step.Source.Account))
            {
                _CurrentEntities[step.Source.Account] = new EncounterDisplayInfo.Entity {
                    Name = step.Source.Name
                }
            }
            ;

            // TODO: handle healing steps
            if (step.Ability.AbilityType == EncounterAbilityType.Damage)
            {
                _CurrentEntities[step.Source.Account].TotalDamage += step.Ability.Value;
                if (step.Ability.Value > _CurrentEntities[step.Source.Account].StrongestAttack.Value)
                {
                    _CurrentEntities[step.Source.Account].StrongestAttack = step.Ability;
                }
            }
        }
    }
Ejemplo n.º 3
0
 void Update()
 {
     if (resolvingEncounter)
     {
         if (currentStep == EncounterStep.None)
         {
             ResetShowAttacker();
             currentStep = EncounterStep.ShiftBefore;
             SetupForShift();
         }
         else if (currentStep == EncounterStep.ShiftBefore && shiftBeforeResolved == attackRecieved.ShiftBefore)
         {
             currentStep = EncounterStep.Attack;
             SetupForAttack();
             FindAllPotentialTargets();
             if (attackerRecieved.side == UnitSide.Player)
             {
                 ShowNextDefender();
             }
         }
         else if (currentStep == EncounterStep.Attack && attackResolved)
         {
             currentStep     = EncounterStep.Defense;
             defenseResolved = false;
             ClearCurrent();
         }
         else if (currentStep == EncounterStep.Defense)
         {
             if (defenseResolved) // all defenses resolved for this same attack.
             {
                 currentStep = EncounterStep.ShiftAfter;
                 SetupForShift();
             }
             else if (IsCurrentCleared()) // load next defender against same attack.
             {
                 ShowNextDefender();
             }
             else if (!currentDefenderIsSetup)
             {
                 SetupForDefender();
             }
         }
         else if (currentStep == EncounterStep.ShiftAfter && shiftAfterResolved == attackRecieved.ShiftAfter)
         {
             if (attackRepeatCounter < attackRecieved.Repeat)
             {
                 attackRepeatCounter++;
                 currentStep = EncounterStep.None;
                 CloneRecievedToCurrent();
                 SetupForAttack();
             }
             else
             {
                 currentStep = EncounterStep.Resolved;
             }
         }
         else if (currentStep == EncounterStep.Resolved)
         {
             resolvingEncounter = false;
             attackerRecieved.ConsumeStamina(attackRecieved.StaminaCost);
             EventManager.RaiseEvent(ObjectEventType.EncountersResolved);
             SetGlobalVisibility(false);
         }
     }
 }