Exemplo n.º 1
0
        public override IEnumerator UpdateView(FightStatus fightStatus)
        {
            if (fightStatus.TryGetEntity(concernedEntity, out HeroStatus heroStatus))
            {
                if (fightStatus.TryGetEntity(ownerId, out PlayerStatus ownerStatus))
                {
                    WeaponDefinition weaponDefinition = (WeaponDefinition)heroStatus.definition;
                    if (null != weaponDefinition)
                    {
                        HeroCharacterObject heroCharacterObject = FightObjectFactory.CreateHeroCharacterObject(weaponDefinition, refCoord.X, refCoord.Y, (Direction)direction);
                        if (null != heroCharacterObject)
                        {
                            heroStatus.view = heroCharacterObject;
                            yield return(heroCharacterObject.LoadAnimationDefinitions(skinId, (Gender)gender));

                            heroCharacterObject.Initialize(fightStatus, ownerStatus, heroStatus);
                            UpdateAudioContext(ownerStatus, heroStatus.baseLife);
                            yield return(heroCharacterObject.Spawn());
                        }
                    }
                }
                else
                {
                    Log.Error(FightEventErrors.PlayerNotFound(ownerId), 98, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\HeroAddedEvent.cs");
                }
            }
            else
            {
                Log.Error(FightEventErrors.EntityNotFound <HeroStatus>(concernedEntity), 103, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\HeroAddedEvent.cs");
            }
            FightLogicExecutor.FireUpdateView(fightStatus.fightId, EventCategory.EntityAddedOrRemoved);
        }
Exemplo n.º 2
0
        private string GetPlayerName(FightStatus concernedFight)
        {
            IReadOnlyList <int> relatedPlayersId = this.relatedPlayersId;

            switch (relatedPlayersId.Count)
            {
            case 0:
                Log.Warning("No player was specified as the source of a team score modification.", 46, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\TeamsScoreModificationEvent.cs");
                return(string.Empty);

            case 1:
                if (concernedFight.TryGetEntity(relatedPlayersId[0], out PlayerStatus entityStatus2))
                {
                    return(entityStatus2.nickname);
                }
                Log.Error($"Could not find player with id {relatedPlayersId[0]}.", 59, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\TeamsScoreModificationEvent.cs");
                return(string.Empty);

            default:
                if (concernedFight.TryGetEntity(relatedPlayersId[0], out PlayerStatus entityStatus))
                {
                    return("Team #" + entityStatus.teamIndex);
                }
                return(string.Empty);
            }
        }
Exemplo n.º 3
0
 public override IEnumerator UpdateView(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out CompanionStatus companionStatus))
     {
         if (fightStatus.TryGetEntity(ownerId, out PlayerStatus ownerStatus))
         {
             if (!ownerStatus.isLocalPlayer)
             {
                 FightMap current = FightMap.current;
                 if (null != current)
                 {
                     if (current.TryGetCellObject(refCoord.X, refCoord.Y, out CellObject cellObject))
                     {
                         ReserveCompanionStatus reserveCompanion = new ReserveCompanionStatus(ownerStatus, (CompanionDefinition)companionStatus.definition, level);
                         yield return(FightUIRework.ShowPlayingCompanion(reserveCompanion, cellObject));
                     }
                     else
                     {
                         Log.Error(FightEventErrors.InvalidPosition(refCoord), 59, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionAddedEvent.cs");
                     }
                 }
             }
             yield return(CreateCompanionCharacterObject(fightStatus, companionStatus, ownerStatus, refCoord.X, refCoord.Y, (Direction)direction));
         }
         else
         {
             Log.Error(FightEventErrors.PlayerNotFound(ownerId), 70, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionAddedEvent.cs");
         }
     }
     else
     {
         Log.Error(FightEventErrors.EntityNotFound <CompanionStatus>(concernedEntity), 75, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionAddedEvent.cs");
     }
     FightLogicExecutor.FireUpdateView(fightStatus.fightId, EventCategory.EntityAddedOrRemoved);
 }
        public override void UpdateStatus(FightStatus fightStatus)
        {
            fightStatus.RemoveEntity(concernedEntity);
            if (fightStatus.TryGetEntity(ownerId, out PlayerStatus entityStatus))
            {
                EntityType   newEntityType = (EntityType)this.newEntityType;
                EntityStatus entityStatus2;
                switch (newEntityType)
                {
                case EntityType.Hero:
                    throw new Exception("[TransformationEvent] Heroes cannot be transformed.");

                case EntityType.Companion:
                    entityStatus2 = CompanionAddedEvent.CreateCompanionStatus(newEntityId, entityDefId, level, entityStatus, refCoord);
                    break;

                case EntityType.Summoning:
                    entityStatus2 = SummoningAddedEvent.CreateSummoningStatus(newEntityId, entityDefId, level, entityStatus, refCoord);
                    break;

                case EntityType.FloorMechanism:
                    entityStatus2 = FloorMechanismAddedEvent.CreateFloorMechanismStatus(newEntityId, entityDefId, level, entityStatus, refCoord);
                    break;

                case EntityType.ObjectMechanism:
                    entityStatus2 = ObjectMechanismAddedEvent.CreateObjectMechanismStatus(newEntityId, entityDefId, level, entityStatus, refCoord);
                    break;

                case EntityType.Global:
                case EntityType.Player:
                case EntityType.Team:
                    Log.Error($"Transformation not handled for type {newEntityType}.", 48, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\TransformationEvent.cs");
                    return;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                IEntityWithAction entityWithAction;
                if (copyActionUsed && fightStatus.TryGetEntity(concernedEntity, out IEntityWithAction entityStatus3) && (entityWithAction = (entityStatus2 as IEntityWithAction)) != null)
                {
                    entityWithAction.actionUsed = entityStatus3.actionUsed;
                    fightStatus.NotifyEntityPlayableStateChanged();
                }
                fightStatus.AddEntity(entityStatus2);
            }
            else
            {
                Log.Error(FightEventErrors.PlayerNotFound(ownerId), 72, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\TransformationEvent.cs");
            }
            FightLogicExecutor.FireUpdateStatus(fightStatus.fightId, EventCategory.EntityAddedOrRemoved);
        }
Exemplo n.º 5
0
        public override IEnumerator UpdateView(FightStatus fightStatus)
        {
            MonoBehaviour monoBehaviour = Main.monoBehaviour;
            List <IEntityWithBoardPresence> removedEntities = m_removedEntities;
            int count = removedEntities.Count;

            for (int i = 0; i < count; i++)
            {
                IEntityWithBoardPresence entity = removedEntities[i];
                MonoBehaviourExtensions.StartCoroutineImmediateSafe(monoBehaviour, RemoveEntityFromBoard(entity), null);
            }
            if (GameStatus.fightType == FightType.BossFight && fightStatus.endReason == FightStatusEndReason.Lose)
            {
                FightMap current = FightMap.current;
                if (null != current)
                {
                    if (fightStatus.TryGetEntity((PlayerStatus p) => p.teamIndex == GameStatus.localPlayerTeamIndex, out PlayerStatus entityStatus))
                    {
                        HeroStatus heroStatus = entityStatus.heroStatus;
                        if (heroStatus != null)
                        {
                            Vector2Int refCoord = heroStatus.area.refCoord;
                            current.AddHeroLostFeedback(refCoord);
                        }
                    }
                    MonoBehaviourExtensions.StartCoroutineImmediateSafe(monoBehaviour, current.ClearMonsterSpawnCells(fightStatus.fightId), null);
                }
            }
            if (fightStatus == FightStatus.local && !GameStatus.hasEnded)
            {
                yield return(DisplayFightResultFeedback(fightStatus));
            }
        }
Exemplo n.º 6
0
 public override void UpdateStatus(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
     {
         if (!entityStatus.TryGetCompanion(companionDefId, out ReserveCompanionStatus companionStatus))
         {
             Log.Error(FightEventErrors.ReserveCompanionNotFound(companionDefId, concernedEntity), 19, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionReserveStateChangedEvent.cs");
         }
         m_wasGiven = companionStatus.isGiven;
         if (m_wasGiven && state == CompanionReserveState.Dead)
         {
             entityStatus.RemoveAdditionalCompanion(companionDefId);
         }
         else
         {
             companionStatus.SetState(state);
         }
         AbstractPlayerUIRework view = entityStatus.view;
         if (null != view)
         {
             if (m_wasGiven && state == CompanionReserveState.Dead)
             {
                 view.RemoveAdditionalCompanionStatus(companionDefId);
             }
             else
             {
                 view.ChangeCompanionStateStatus(companionDefId, state);
             }
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 48, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionReserveStateChangedEvent.cs");
     }
 }
Exemplo n.º 7
0
 public override void UpdateStatus(FightStatus fightStatus)
 {
     //IL_002f: Unknown result type (might be due to invalid IL or missing references)
     //IL_0043: Unknown result type (might be due to invalid IL or missing references)
     //IL_0048: Unknown result type (might be due to invalid IL or missing references)
     //IL_004f: Unknown result type (might be due to invalid IL or missing references)
     if (fightStatus.TryGetEntity(concernedEntity, out IEntityWithBoardPresence entityStatus))
     {
         Area       area         = entityStatus.area;
         int        count        = cells.Count;
         Vector2Int val          = (Vector2Int)cells[0];
         Vector2Int newRefCoords = (Vector2Int)cells[count - 1];
         entityStatus.area.MoveTo(newRefCoords);
         fightStatus.NotifyEntityAreaMoved();
         CharacterStatus characterStatus;
         if (IsMovementAction() && (characterStatus = (entityStatus as CharacterStatus)) != null)
         {
             characterStatus.actionUsed = true;
             fightStatus.NotifyEntityPlayableStateChanged();
         }
     }
     else
     {
         Log.Error(FightEventErrors.EntityNotFound <IEntityWithBoardPresence>(concernedEntity), 46, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\EntityAreaMovedEvent.cs");
     }
     FightLogicExecutor.FireUpdateStatus(fightStatus.fightId, EventCategory.EntityMoved);
 }
Exemplo n.º 8
0
        private static CellObject GetTargetedCell(FightStatus fightStatus, CastTarget castTarget)
        {
            //IL_0055: Unknown result type (might be due to invalid IL or missing references)
            //IL_005a: Unknown result type (might be due to invalid IL or missing references)
            FightMap current = FightMap.current;

            if (null == current)
            {
                return(null);
            }
            switch (castTarget.ValueCase)
            {
            case CastTarget.ValueOneofCase.Cell:
            {
                CellCoord cell = castTarget.Cell;
                return(current.GetCellObject(cell.X, cell.Y));
            }

            case CastTarget.ValueOneofCase.EntityId:
            {
                int entityId = castTarget.EntityId;
                if (fightStatus.TryGetEntity(entityId, out IEntityWithBoardPresence entityStatus))
                {
                    Vector2Int refCoord = entityStatus.area.refCoord;
                    return(current.GetCellObject(refCoord.get_x(), refCoord.get_y()));
                }
                return(null);
            }

            default:
                return(null);
            }
        }
        public override bool GetValue(DynamicValueContext context, out int value)
        {
            AssembledEntityContext assembledEntityContext = context as AssembledEntityContext;

            if (assembledEntityContext == null)
            {
                value = 0;
                return(false);
            }
            int num = 0;
            IReadOnlyList <int> assemblingIds = assembledEntityContext.assembling.assemblingIds;
            FightStatus         fightStatus   = assembledEntityContext.fightStatus;
            int i = 0;

            for (int count = assemblingIds.Count; i < count; i++)
            {
                if (fightStatus.TryGetEntity(assemblingIds[i], out FloorMechanismStatus entityStatus))
                {
                    int?activationValue = entityStatus.activationValue;
                    if (activationValue.HasValue)
                    {
                        num += activationValue.Value;
                    }
                }
            }
            value = num;
            return(true);
        }
Exemplo n.º 10
0
 public override IEnumerator UpdateView(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
     {
         AbstractPlayerUIRework view = entityStatus.view;
         if (null != view)
         {
             int           count = moves.Count;
             IEnumerator[] array = new IEnumerator[count];
             for (int i = 0; i < count; i++)
             {
                 SpellMovement spellMovement = moves[i];
                 if (spellMovement.From == Ankama.Cube.Protocols.FightCommonProtocol.SpellMovementZone.Hand)
                 {
                     int spellInstanceId = spellMovement.Spell.SpellInstanceId;
                     array[i] = view.RemoveSpell(spellInstanceId, i);
                 }
                 else if (spellMovement.To == Ankama.Cube.Protocols.FightCommonProtocol.SpellMovementZone.Hand)
                 {
                     array[i] = view.AddSpell(spellMovement.Spell, i);
                 }
             }
             yield return(EnumeratorUtility.ParallelRecursiveImmediateSafeExecution(array));
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 112, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\SpellsMovedEvent.cs");
     }
     FightLogicExecutor.FireUpdateView(fightStatus.fightId, EventCategory.SpellsMoved);
 }
Exemplo n.º 11
0
 public override void UpdateStatus(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
     {
         if (entityStatus.TryGetSpell(spellInstanceId, out SpellStatus spellStatus))
         {
             if (null == spellStatus.definition)
             {
                 if (RuntimeData.spellDefinitions.TryGetValue(spellDefId, out SpellDefinition value))
                 {
                     spellStatus.Upgrade(value, spellLevel);
                 }
                 else
                 {
                     Log.Error(FightEventErrors.DefinitionNotFound <SpellDefinition>(spellDefId), 31, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\PlaySpellEvent.cs");
                 }
             }
         }
         else
         {
             Log.Error($"Could not find spell with instance id {spellInstanceId} for player with id {concernedEntity}.", 37, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\PlaySpellEvent.cs");
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 42, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\PlaySpellEvent.cs");
     }
 }
 public override IEnumerator UpdateView(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
     {
         AbstractPlayerUIRework view = entityStatus.view;
         if (!(null != view))
         {
             yield break;
         }
         int count = companionDefId.Count;
         if (count > 0)
         {
             IEnumerator[] array = new IEnumerator[count];
             for (int i = 0; i < count; i++)
             {
                 array[i] = view.AddCompanion(companionDefId[i], levels[i], i);
             }
             yield return(EnumeratorUtility.ParallelRecursiveImmediateSafeExecution(array));
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 59, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionAddedInReserveEvent.cs");
     }
 }
Exemplo n.º 13
0
 public override IEnumerator UpdateView(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
     {
         if (entityStatus.TryGetCompanion(companionDefId, out ReserveCompanionStatus companionStatus))
         {
             if (FightLogicExecutor.GetFightStatus(toFightId).TryGetEntity(toPlayerId, out PlayerStatus entityStatus2))
             {
                 AbstractPlayerUIRework view = entityStatus2.view;
                 if (null != view)
                 {
                     yield return(view.AddAdditionalCompanion(entityStatus, companionDefId, companionStatus.level));
                 }
             }
             else
             {
                 Log.Error(FightEventErrors.PlayerNotFound(toPlayerId, toFightId), 62, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionGivenEvent.cs");
             }
         }
         else
         {
             Log.Error(FightEventErrors.ReserveCompanionNotFound(companionDefId, concernedEntity), 67, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionGivenEvent.cs");
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 72, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionGivenEvent.cs");
     }
 }
Exemplo n.º 14
0
        private static IEnumerable <Vector2Int> EnumerateOtherObjectsInAssemblagePositions(FightStatus fightStatus, int concernedEntity, IReadOnlyList <int> entitiesInAssemblage)
        {
            int entityCountInAssemblage = entitiesInAssemblage.Count;
            int num2;

            for (int i = 0; i < entityCountInAssemblage; i = num2)
            {
                int num = entitiesInAssemblage[i];
                if (num != concernedEntity)
                {
                    if (fightStatus.TryGetEntity(num, out IEntityWithAssemblage entityStatus))
                    {
                        IObjectWithAssemblage objectWithAssemblage;
                        if ((objectWithAssemblage = (entityStatus.view as IObjectWithAssemblage)) != null)
                        {
                            yield return(objectWithAssemblage.cellObject.coords);
                        }
                        else
                        {
                            Log.Error(FightEventErrors.EntityHasIncompatibleView <IObjectWithAssemblage>(entityStatus), 65, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\AssemblageChangedEvent.cs");
                        }
                    }
                    else
                    {
                        Log.Error(FightEventErrors.EntityNotFound <IEntityWithAssemblage>(num), 70, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\AssemblageChangedEvent.cs");
                    }
                }
                num2 = i + 1;
            }
        }
Exemplo n.º 15
0
 public override IEnumerator UpdateView(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out IEntityWithBoardPresence entityStatus))
     {
         IObjectWithArmoredLife objectWithArmoredLife;
         if ((objectWithArmoredLife = (entityStatus.view as IObjectWithArmoredLife)) != null)
         {
             objectWithArmoredLife.SetBaseLife(maxLifeAfter);
         }
         else
         {
             Log.Error(FightEventErrors.EntityHasIncompatibleView <IObjectWithArmoredLife>(entityStatus), 37, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\MaxLifeChangedEvent.cs");
         }
         if (entityStatus.type == EntityType.Hero)
         {
             HeroStatus heroStatus = (HeroStatus)entityStatus;
             if (heroStatus.ownerId == fightStatus.localPlayerId)
             {
                 FightMap current = FightMap.current;
                 if (null != current)
                 {
                     current.SetLocalPlayerHeroLife(heroStatus.life, maxLifeAfter);
                 }
             }
             if (fightStatus.TryGetEntity(heroStatus.ownerId, out PlayerStatus entityStatus2))
             {
                 AbstractPlayerUIRework view = entityStatus2.view;
                 if (null != view)
                 {
                     view.ChangeHeroBaseLifePoints(maxLifeAfter);
                 }
             }
             else
             {
                 Log.Error(FightEventErrors.PlayerNotFound(heroStatus.ownerId), 62, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\MaxLifeChangedEvent.cs");
             }
         }
     }
     else
     {
         Log.Error(FightEventErrors.EntityNotFound <IEntityWithBoardPresence>(concernedEntity), 68, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\MaxLifeChangedEvent.cs");
     }
     FightLogicExecutor.FireUpdateView(fightStatus.fightId, EventCategory.LifeArmorChanged);
     yield break;
 }
Exemplo n.º 16
0
        public override void UpdateStatus(FightStatus fightStatus)
        {
            if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
            {
                bool flag  = fightStatus == FightStatus.local;
                int  count = moves.Count;
                for (int i = 0; i < count; i++)
                {
                    SpellMovement spellMovement = moves[i];
                    if (flag)
                    {
                        FightCastManager.CheckSpellPlayed(spellMovement.Spell.SpellInstanceId);
                    }
                    switch (spellMovement.To)
                    {
                    case Ankama.Cube.Protocols.FightCommonProtocol.SpellMovementZone.Nowhere:
                    case Ankama.Cube.Protocols.FightCommonProtocol.SpellMovementZone.Deck:
                        if (spellMovement.From == Ankama.Cube.Protocols.FightCommonProtocol.SpellMovementZone.Hand)
                        {
                            int spellInstanceId = spellMovement.Spell.SpellInstanceId;
                            entityStatus.RemoveSpell(spellInstanceId);
                            AbstractPlayerUIRework view2 = entityStatus.view;
                            if (null != view2)
                            {
                                view2.RemoveSpellStatus(spellInstanceId, i);
                            }
                        }
                        break;

                    case Ankama.Cube.Protocols.FightCommonProtocol.SpellMovementZone.Hand:
                    {
                        SpellInfo   spell       = spellMovement.Spell;
                        SpellStatus spellStatus = SpellStatus.TryCreate(spell, entityStatus);
                        if (spellStatus != null)
                        {
                            entityStatus.AddSpell(spellStatus);
                            AbstractPlayerUIRework view = entityStatus.view;
                            if (null != view)
                            {
                                view.AddSpellStatus(spell, i);
                            }
                        }
                        break;
                    }

                    default:
                        throw new ArgumentOutOfRangeException($"Spell moved to unknown zone: {spellMovement.To}");
                    }
                }
            }
            else
            {
                Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 75, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\SpellsMovedEvent.cs");
            }
            FightLogicExecutor.FireUpdateStatus(fightStatus.fightId, EventCategory.SpellsMoved);
        }
 public override IEnumerator UpdateView(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out FloorMechanismStatus entityStatus))
     {
         if (fightStatus.TryGetEntity(ownerId, out PlayerStatus entityStatus2))
         {
             yield return(CreateFloorMechanismObject(fightStatus, entityStatus, entityStatus2, refCoord.X, refCoord.Y));
         }
         else
         {
             Log.Error(FightEventErrors.PlayerNotFound(ownerId), 43, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\FloorMechanismAddedEvent.cs");
         }
     }
     else
     {
         Log.Error(FightEventErrors.EntityNotFound <FloorMechanismStatus>(concernedEntity), 48, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\FloorMechanismAddedEvent.cs");
     }
     FightLogicExecutor.FireUpdateView(fightStatus.fightId, EventCategory.EntityAddedOrRemoved);
 }
Exemplo n.º 18
0
 public override void UpdateStatus(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out IEntityWithAssemblage entityStatus))
     {
         entityStatus.assemblingIds = allEntities;
     }
     else
     {
         Log.Error(FightEventErrors.EntityNotFound <IEntityWithAssemblage>(concernedEntity), 20, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\AssemblageChangedEvent.cs");
     }
 }
Exemplo n.º 19
0
 private IEnumerator PropertyViewChanged(FightStatus fightStatus, PropertyId property)
 {
     if (property == PropertyId.PlaySpellForbidden && fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
     {
         AbstractPlayerUIRework view = entityStatus.view;
         if (null != view)
         {
             yield return(view.UpdateAvailableActions(recomputeSpellCosts: false));
         }
     }
 }
Exemplo n.º 20
0
 public override void UpdateStatus(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out IEntityWithBoardPresence entityStatus))
     {
         entityStatus.SetCarac(CaracId.PhysicalHealModifier, valueAfter);
     }
     else
     {
         Log.Error(FightEventErrors.EntityNotFound <IEntityWithBoardPresence>(concernedEntity), 19, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\PhysicalHealModifierChangedEvent.cs");
     }
 }
 public override void UpdateStatus(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out IEntity entityStatus))
     {
         entityStatus.SetCarac(CaracId.MagicalDamageModifier, valueAfter);
     }
     else
     {
         Log.Error(FightEventErrors.EntityNotFound <IEntity>(concernedEntity), 18, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\MagicalDamageModifierChangedEvent.cs");
     }
     FightLogicExecutor.FireUpdateStatus(fightStatus.fightId, EventCategory.DamageModifierChanged);
 }
Exemplo n.º 22
0
 public override void UpdateStatus(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out IEntityWithElementaryState entityStatus))
     {
         entityStatus.ChangeElementaryState((ElementaryStates)elementaryState);
     }
     else
     {
         Log.Error(FightEventErrors.EntityNotFound <IEntityWithElementaryState>(concernedEntity), 19, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\ElementaryChangedEvent.cs");
     }
     FightLogicExecutor.FireUpdateStatus(fightStatus.fightId, EventCategory.ElementaryStateChanged);
 }
Exemplo n.º 23
0
 public override void UpdateStatus(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out IEntityWithLife entityStatus))
     {
         entityStatus.SetCarac(CaracId.LifeMax, maxLifeAfter);
     }
     else
     {
         Log.Error(FightEventErrors.EntityNotFound <IEntityWithLife>(concernedEntity), 21, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\MaxLifeChangedEvent.cs");
     }
     FightLogicExecutor.FireUpdateStatus(fightStatus.fightId, EventCategory.LifeArmorChanged);
 }
 public override void UpdateStatus(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out CharacterStatus entityStatus))
     {
         entityStatus.actionUsed = false;
         fightStatus.NotifyEntityPlayableStateChanged();
     }
     else
     {
         Log.Error(FightEventErrors.EntityNotFound <CharacterStatus>(concernedEntity), 20, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\EntityActionResetEvent.cs");
     }
 }
Exemplo n.º 25
0
 public override IEnumerator UpdateView(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out IEntityWithBoardPresence entityStatus))
     {
         IObjectWithCounterEffects objectWithCounterEffects;
         IObjectWithCounterEffects isoObject = objectWithCounterEffects = (entityStatus.view as IObjectWithCounterEffects);
         if (objectWithCounterEffects != null)
         {
             if (counterReplaced.HasValue)
             {
                 yield return(isoObject.RemoveFloatingCounterEffect());
             }
             CaracId floatingCounterType = (CaracId)this.floatingCounterType;
             if (!FightSpellEffectFactory.TryGetFloatingCounterEffect(floatingCounterType, (PropertyId?)sightProperty, out FloatingCounterEffect effect))
             {
                 yield break;
             }
             if (null != effect)
             {
                 if (valueBefore == 0 || counterReplaced.HasValue)
                 {
                     yield return(isoObject.InitializeFloatingCounterEffect(effect, valueAfter));
                 }
                 else
                 {
                     FloatingCounterFeedback currentFloatingCounterFeedback = isoObject.GetCurrentFloatingCounterFeedback();
                     currentFloatingCounterFeedback.ChangeVisual(effect);
                     yield return(currentFloatingCounterFeedback.SetCount(valueAfter));
                 }
                 if (parentEventId.HasValue)
                 {
                     FightSpellEffectFactory.SetupSpellEffectOverrides(effect, fightStatus.fightId, parentEventId.Value);
                 }
             }
             else
             {
                 Log.Error(string.Format("No prefab defined for {0} {1}.", "FloatingCounterEffect", floatingCounterType), 68, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\FloatingCounterValueChangedEvent.cs");
             }
         }
         else
         {
             Log.Error(FightEventErrors.EntityHasIncompatibleView <IObjectWithCounterEffects>(entityStatus), 74, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\FloatingCounterValueChangedEvent.cs");
         }
     }
     else
     {
         Log.Error(FightEventErrors.EntityNotFound <IEntityWithBoardPresence>(concernedEntity), 79, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\FloatingCounterValueChangedEvent.cs");
     }
 }
Exemplo n.º 26
0
        public override void UpdateStatus(FightStatus fightStatus)
        {
            if (!fightStatus.TryGetEntity(ownerId, out PlayerStatus entityStatus))
            {
                Log.Error(string.Format("Could not find a {0} entity with id {1}.", "PlayerStatus", ownerId), 17, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\SummoningAddedEvent.cs");
                return;
            }
            SummoningStatus summoningStatus = CreateSummoningStatus(concernedEntity, entityDefId, level, entityStatus, refCoord);

            if (summoningStatus != null)
            {
                fightStatus.AddEntity(summoningStatus);
                FightLogicExecutor.FireUpdateStatus(fightStatus.fightId, EventCategory.EntityAddedOrRemoved);
            }
        }
Exemplo n.º 27
0
        public override void Initialize()
        {
            base.Initialize();
            FightStatus local = FightStatus.local;

            if (local != null)
            {
                m_turnIndex = local.turnIndex;
                int localPlayerId = local.localPlayerId;
                if (local.TryGetEntity((HeroStatus e) => e.ownerId == localPlayerId, out HeroStatus entityStatus))
                {
                    m_localPlayerHeroLife = Mathf.Clamp01((float)entityStatus.life / (float)entityStatus.baseLife);
                }
            }
        }
Exemplo n.º 28
0
 private void PropertyStatusChanged(FightStatus fightStatus, PropertyId property)
 {
     if (property == PropertyId.PlaySpellForbidden && fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
     {
         AbstractPlayerUIRework view = entityStatus.view;
         if (null != view)
         {
             view.RefreshAvailableActions(recomputeSpellCosts: false);
         }
     }
     if (PropertiesUtility.PreventsAction(property))
     {
         fightStatus.NotifyEntityPlayableStateChanged();
     }
 }
Exemplo n.º 29
0
        public override void UpdateStatus(FightStatus fightStatus)
        {
            fightStatus.currentTurnPlayerId = 0;
            if (fightStatus != FightStatus.local || fightStatus.localPlayerId != concernedEntity)
            {
                return;
            }
            switch (FightCastManager.currentCastType)
            {
            case FightCastManager.CurrentCastType.Spell:
                FightCastManager.StopCastingSpell(cancelled: true);
                break;

            case FightCastManager.CurrentCastType.Companion:
                FightCastManager.StopInvokingCompanion(cancelled: true);
                break;

            default:
                throw new ArgumentOutOfRangeException();

            case FightCastManager.CurrentCastType.None:
                break;
            }
            FightMap current = FightMap.current;

            if (null != current)
            {
                current.SetNoInteractionPhase();
            }
            FightUIRework instance = FightUIRework.instance;

            if (null != instance)
            {
                instance.EndLocalPlayerTurn();
            }
            if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
            {
                AbstractPlayerUIRework view = entityStatus.view;
                if (null != view)
                {
                    view.SetUIInteractable(interactable: false);
                }
            }
            else
            {
                Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 60, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\TurnEndedEvent.cs");
            }
        }
 public override void UpdateStatus(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(ownerId, out PlayerStatus entityStatus))
     {
         FloorMechanismStatus floorMechanismStatus = CreateFloorMechanismStatus(concernedEntity, entityDefId, level, entityStatus, refCoord);
         if (floorMechanismStatus != null)
         {
             fightStatus.AddEntity(floorMechanismStatus);
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(ownerId), 25, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\FloorMechanismAddedEvent.cs");
     }
     FightLogicExecutor.FireUpdateStatus(fightStatus.fightId, EventCategory.EntityAddedOrRemoved);
 }