Esempio n. 1
0
        public override IEnumerator UpdateView(FightStatus fightStatus)
        {
            if (fightStatus.TryGetEntity(concernedEntity, out IEntityWithBoardPresence entityStatus))
            {
                IsoObject view = entityStatus.view;
                if (null != view)
                {
                    switch (reason)
                    {
                    case 2:
                    case 4:
                    case 6:
                    case 8:
                    case 9:
                    {
                        ICharacterObject characterObject2;
                        if ((characterObject2 = (view as ICharacterObject)) != null)
                        {
                            yield return(characterObject2.Die());
                        }
                        HeroStatus heroStatus;
                        if ((heroStatus = (entityStatus as HeroStatus)) == null)
                        {
                            break;
                        }
                        if (fightStatus.TryGetEntity(heroStatus.ownerId, out PlayerStatus entityStatus2))
                        {
                            AbstractPlayerUIRework view2 = entityStatus2.view;
                            if (null != view2)
                            {
                                view2.ChangeHeroLifePoints(0);
                            }
                            if (GameStatus.fightType == FightType.BossFight)
                            {
                                FightUIRework instance = FightUIRework.instance;
                                if (null != instance)
                                {
                                    FightInfoMessage message = FightInfoMessage.HeroDeath(MessageInfoRibbonGroup.MyID);
                                    instance.DrawInfoMessage(message, entityStatus2.nickname);
                                }
                            }
                        }
                        else
                        {
                            Log.Error(FightEventErrors.PlayerNotFound(heroStatus.ownerId), 68, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\EntityRemovedEvent.cs");
                        }
                        break;
                    }

                    case 7:
                    {
                        IObjectWithActivation objectWithActivation;
                        if ((objectWithActivation = (view as IObjectWithActivation)) != null)
                        {
                            yield return(objectWithActivation.WaitForActivationEnd());
                        }
                        else
                        {
                            Log.Error(FightEventErrors.EntityHasIncompatibleView <IObjectWithActivation>(entityStatus), 82, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\EntityRemovedEvent.cs");
                        }
                        break;
                    }

                    case 5:
                    {
                        ICharacterObject characterObject;
                        if ((characterObject = (view as ICharacterObject)) != null)
                        {
                            yield return(characterObject.Die());
                        }
                        else
                        {
                            Log.Error(FightEventErrors.EntityHasIncompatibleView <ICharacterObject>(entityStatus), 95, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\EntityRemovedEvent.cs");
                        }
                        break;
                    }

                    case 3:
                        throw new ArgumentException("Transformations should not trigger an EntityRemovedEvent.");

                    default:
                        throw new ArgumentOutOfRangeException($"EntityRemovedReason not handled: {reason}");

                    case 1:
                        break;
                    }
                    view.DetachFromCell();
                    view.Destroy();
                }
                else
                {
                    Log.Error(FightEventErrors.EntityHasNoView(entityStatus), 112, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\EntityRemovedEvent.cs");
                }
            }
            else
            {
                Log.Error(FightEventErrors.EntityNotFound <IEntityWithBoardPresence>(concernedEntity), 117, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\EntityRemovedEvent.cs");
            }
            FightLogicExecutor.FireUpdateView(fightStatus.fightId, EventCategory.EntityAddedOrRemoved);
        }
Esempio n. 2
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);
        }