public override IEnumerator UpdateView(FightStatus fightStatus)
        {
            if (fightStatus.TryGetEntity(concernedEntity, out IEntityWithBoardPresence entityStatus))
            {
                IsoObject view = entityStatus.view;
                if (null != view)
                {
                    IObjectWithAction objectWithAction;
                    if ((objectWithAction = (view as IObjectWithAction)) != null)
                    {
                        objectWithAction.SetPhysicalDamageBoost(valueAfter);
                    }
                    else
                    {
                        Log.Error(FightEventErrors.EntityHasIncompatibleView <IObjectWithAction>(entityStatus), 37, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\PhysicalDamageModifierChangedEvent.cs");
                    }
                    CellObject cellObject = view.cellObject;
                    if (null != cellObject)
                    {
                        if (valueAfter > valueBefore)
                        {
                            yield return(FightSpellEffectFactory.PlayGenericEffect(SpellEffectKey.PhysicalDamageGain, fightStatus.fightId, parentEventId, view, fightStatus.context));

                            ValueChangedFeedback.Launch(valueAfter - valueBefore, ValueChangedFeedback.Type.Action, cellObject.get_transform());
                        }
                        else
                        {
                            yield return(FightSpellEffectFactory.PlayGenericEffect(SpellEffectKey.PhysicalDamageLoss, fightStatus.fightId, parentEventId, view, fightStatus.context));

                            ValueChangedFeedback.Launch(valueAfter - valueBefore, ValueChangedFeedback.Type.Action, cellObject.get_transform());
                        }
                    }
                    else
                    {
                        Log.Warning("Tried to apply a damage modifier on target named " + view.get_name() + " (" + ((object)view).GetType().Name + ") but the target is no longer on the board.", 56, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\PhysicalDamageModifierChangedEvent.cs");
                    }
                }
                else
                {
                    Log.Error(FightEventErrors.EntityHasNoView(entityStatus), 61, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\PhysicalDamageModifierChangedEvent.cs");
                }
            }
            else
            {
                Log.Error(FightEventErrors.EntityNotFound <IEntityWithBoardPresence>(concernedEntity), 66, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\PhysicalDamageModifierChangedEvent.cs");
            }
        }
예제 #2
0
        public override IEnumerator UpdateView(FightStatus fightStatus)
        {
            int fightId = fightStatus.fightId;

            if (fightStatus.TryGetEntity(concernedEntity, out IEntityWithMovement entityStatus))
            {
                IsoObject isoObject = entityStatus.view;
                if (null != isoObject)
                {
                    IObjectWithMovement objectWithMovement;
                    if ((objectWithMovement = (isoObject as IObjectWithMovement)) != null)
                    {
                        objectWithMovement.SetMovementPoints(valueAfter);
                    }
                    else
                    {
                        Log.Error(FightEventErrors.EntityHasIncompatibleView <IObjectWithMovement>(entityStatus), 46, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\MovementPointsChangedEvent.cs");
                    }
                    if (valueAfter > valueBefore)
                    {
                        yield return(FightSpellEffectFactory.PlayGenericEffect(SpellEffectKey.MovementPointGain, fightId, parentEventId, isoObject, fightStatus.context));

                        ValueChangedFeedback.Launch(valueAfter - valueBefore, ValueChangedFeedback.Type.Movement, isoObject.cellObject.get_transform());
                    }
                    else
                    {
                        yield return(FightSpellEffectFactory.PlayGenericEffect(SpellEffectKey.MovementPointLoss, fightId, parentEventId, isoObject, fightStatus.context));

                        ValueChangedFeedback.Launch(valueAfter - valueBefore, ValueChangedFeedback.Type.Movement, isoObject.cellObject.get_transform());
                    }
                }
                else
                {
                    Log.Error(FightEventErrors.EntityHasNoView(entityStatus), 62, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\MovementPointsChangedEvent.cs");
                }
            }
            else
            {
                Log.Error(FightEventErrors.EntityNotFound <IEntityWithMovement>(concernedEntity), 67, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\MovementPointsChangedEvent.cs");
            }
            FightLogicExecutor.FireUpdateView(fightId, EventCategory.MovementPointsChanged);
        }
예제 #3
0
        public override IEnumerator UpdateView(FightStatus fightStatus)
        {
            int fightId = fightStatus.fightId;

            if (fightStatus.TryGetEntity(concernedEntity, out IEntityWithBoardPresence entityStatus))
            {
                int change = 0;
                int num    = 0;
                int num2   = 0;
                LifeModificationType lifeModificationType = LifeModificationType.Undefined;
                if (armorAfter.HasValue)
                {
                    num = armorAfter.Value;
                    if (armorBefore.HasValue)
                    {
                        int value = armorBefore.Value;
                        change += num - value;
                        if (value > num)
                        {
                            lifeModificationType = LifeModificationType.Damage;
                        }
                        else if (value < num)
                        {
                            lifeModificationType = LifeModificationType.ArmorGain;
                        }
                    }
                }
                if (lifeAfter.HasValue)
                {
                    num2 = lifeAfter.Value;
                    if (lifeBefore.HasValue)
                    {
                        int value2 = lifeBefore.Value;
                        change += num2 - value2;
                        if (value2 > num2)
                        {
                            lifeModificationType = ((num2 > 0) ? LifeModificationType.Damage : LifeModificationType.Death);
                        }
                        else if (value2 < num2)
                        {
                            lifeModificationType = ((entityStatus.type == EntityType.ObjectMechanism) ? LifeModificationType.ArmorGain : LifeModificationType.Heal);
                        }
                    }
                }
                if (lifeAfter.HasValue && entityStatus.type == EntityType.Hero)
                {
                    HeroStatus heroStatus = (HeroStatus)entityStatus;
                    if (heroStatus.ownerId == fightStatus.localPlayerId)
                    {
                        FightMap current = FightMap.current;
                        if (null != current)
                        {
                            current.SetLocalPlayerHeroLife(num2, heroStatus.baseLife);
                        }
                    }
                    if (fightStatus.TryGetEntity(heroStatus.ownerId, out PlayerStatus entityStatus2))
                    {
                        AbstractPlayerUIRework view = entityStatus2.view;
                        if (null != view)
                        {
                            view.ChangeHeroLifePoints(num2);
                        }
                        TryDrawLowLifeMessage(num2, entityStatus2);
                    }
                }
                IsoObject isoObject = entityStatus.view;
                if (null != isoObject)
                {
                    IObjectWithArmoredLife objectWithArmoredLife2;
                    IObjectWithArmoredLife objectWithArmoredLife = objectWithArmoredLife2 = (isoObject as IObjectWithArmoredLife);
                    if (objectWithArmoredLife2 != null)
                    {
                        int life  = lifeAfter.HasValue ? num2 : objectWithArmoredLife.life;
                        int armor = armorAfter.HasValue ? num : objectWithArmoredLife.armor;
                        objectWithArmoredLife.SetArmoredLife(life, armor);
                    }
                    else
                    {
                        Log.Error(FightEventErrors.EntityHasIncompatibleView <IObjectWithArmoredLife>(entityStatus), 151, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\ArmoredLifeChangedEvent.cs");
                        objectWithArmoredLife = null;
                    }
                    switch (lifeModificationType)
                    {
                    case LifeModificationType.ArmorGain:
                        yield return(FightSpellEffectFactory.PlayGenericEffect(SpellEffectKey.ArmorGain, fightId, parentEventId, isoObject, fightStatus.context));

                        ValueChangedFeedback.Launch(change, ValueChangedFeedback.Type.Heal, isoObject.cellObject.get_transform());
                        break;

                    case LifeModificationType.Damage:
                        yield return(FightSpellEffectFactory.PlayGenericEffect(SpellEffectKey.Damage, fightId, parentEventId, isoObject, fightStatus.context));

                        ValueChangedFeedback.Launch(change, ValueChangedFeedback.Type.Damage, isoObject.cellObject.get_transform());
                        if (objectWithArmoredLife != null)
                        {
                            yield return(objectWithArmoredLife.Hit(isoObject.area.refCoord));
                        }
                        break;

                    case LifeModificationType.Heal:
                        yield return(FightSpellEffectFactory.PlayGenericEffect(SpellEffectKey.Heal, fightId, parentEventId, isoObject, fightStatus.context));

                        ValueChangedFeedback.Launch(change, ValueChangedFeedback.Type.Heal, isoObject.cellObject.get_transform());
                        break;

                    case LifeModificationType.Death:
                        yield return(FightSpellEffectFactory.PlayGenericEffect(SpellEffectKey.Damage, fightId, parentEventId, isoObject, fightStatus.context));

                        ValueChangedFeedback.Launch(change, ValueChangedFeedback.Type.Damage, isoObject.cellObject.get_transform());
                        objectWithArmoredLife?.LethalHit(isoObject.area.refCoord);
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();

                    case LifeModificationType.Undefined:
                        break;
                    }
                }
                else
                {
                    Log.Error(FightEventErrors.EntityHasNoView(entityStatus), 197, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\ArmoredLifeChangedEvent.cs");
                }
            }
            else
            {
                Log.Error(FightEventErrors.EntityNotFound <IEntityWithBoardPresence>(concernedEntity), 202, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\ArmoredLifeChangedEvent.cs");
            }
            FightLogicExecutor.FireUpdateView(fightId, EventCategory.LifeArmorChanged);
        }