Ejemplo n.º 1
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));
            }
        }
Ejemplo n.º 2
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");
     }
 }
Ejemplo n.º 3
0
        private static IEnumerator DisplayFightResultFeedback(FightStatus fightStatus)
        {
            switch (GameStatus.fightType)
            {
            case FightType.None:
            case FightType.Versus:
                yield break;

            case FightType.BossFight:
                if (fightStatus.endReason != FightStatusEndReason.Lose)
                {
                    yield break;
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();

            case FightType.TeamVersus:
                break;
            }
            FightState instance = FightState.instance;

            if (instance != null)
            {
                yield return(instance.ShowFightEndFeedback(fightStatus.endReason));
            }
            else
            {
                Log.Error("Could not find fight state.", 189, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\FightEndedEvent.cs");
            }
        }
Ejemplo n.º 4
0
 public void Initialize(FightStatus fightStatus, PlayerStatus ownerStatus, CharacterStatus characterStatus)
 {
     base.Initialize(fightStatus, ownerStatus, characterStatus);
     base.life           = characterStatus.life;
     actionValue         = characterStatus.actionValue;
     base.armor          = characterStatus.armor;
     base.baseLife       = characterStatus.baseLife;
     actionType          = characterStatus.actionType;
     hasRange            = characterStatus.hasRange;
     movementPoints      = characterStatus.movementPoints;
     baseMovementPoints  = characterStatus.movementPoints;
     physicalDamageBoost = characterStatus.physicalDamageBoost;
     physicalHealBoost   = characterStatus.physicalHealBoost;
     m_context.SetParameterValue("life", base.life);
     TimelineContextUtility.SetFightContext(m_playableDirector, fightStatus.context);
     m_base.InitializeState(fightStatus, characterStatus, ownerStatus);
     m_lifeUI.set_enabled(false);
     m_lifeUI.Setup(characterStatus.life);
     m_lifeUI.SetValues(characterStatus.life, characterStatus.armor);
     m_actionUI.set_enabled(false);
     m_actionUI.Setup(characterStatus.actionType, characterStatus.hasRange);
     if (actionValue.HasValue)
     {
         m_actionUI.SetValue(actionValue.Value);
     }
     m_elementaryStateUI.Setup();
 }
Ejemplo n.º 5
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);
            }
        }
Ejemplo n.º 6
0
        public override void UpdateStatus(FightStatus fightStatus)
        {
            FightScore score = GetScore();

            GameStatus.allyTeamPoints     = score.myTeamScore.scoreAfter;
            GameStatus.opponentTeamPoints = score.opponentTeamScore.scoreAfter;
        }
Ejemplo 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);
 }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
0
        public override IEnumerator UpdateView(FightStatus fightStatus)
        {
            if (fightStatus != FightStatus.local)
            {
                yield break;
            }
            FightUIRework instance = FightUIRework.instance;

            if (!(null != instance))
            {
                yield break;
            }
            if (GameStatus.GetFightStatus(fromFightId).TryGetEntity(fromPlayerId, out PlayerStatus entityStatus))
            {
                if (RuntimeData.companionDefinitions.TryGetValue(companionDefId, out CompanionDefinition value))
                {
                    PlayerStatus localPlayer = fightStatus.GetLocalPlayer();
                    if (concernedEntity == localPlayer.id)
                    {
                        FightInfoMessage message = FightInfoMessage.ReceivedCompanion(MessageInfoRibbonGroup.MyID);
                        instance.DrawInfoMessage(message, entityStatus.nickname, RuntimeData.FormattedText(value.i18nNameId));
                    }
                }
                else
                {
                    Log.Error(FightEventErrors.DefinitionNotFound <CompanionDefinition>(companionDefId), 37, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionReceivedEvent.cs");
                }
            }
            else
            {
                Log.Error(FightEventErrors.PlayerNotFound(fromPlayerId, fromFightId), 42, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionReceivedEvent.cs");
            }
        }
Ejemplo 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);
 }
Ejemplo n.º 11
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);
            }
        }
Ejemplo n.º 12
0
 public override void UpdateStatus(FightStatus fightStatus)
 {
     if (isLocalTeam)
     {
         GameStatus.localPlayerTeamIndex = teamIndex;
     }
 }
    public IEnumerator Run()
    {
        _Register();
        _view.Enter(_playerData, _enemiesData);
        _fightStatus = FightStatus.Fighting;
        _roundStatus = RoundStatus.HeroTurn;
        _roundCount  = 0;

        while (!_leave)
        {
            switch (_fightStatus)
            {
            case FightStatus.Fighting:
                yield return(_FightRound());

                break;

            case FightStatus.FightResult:
                _BattleResultEvent();
                _fightStatus = FightStatus.FightEnd;
                break;

            case FightStatus.FightEnd:
                break;
            }
            yield return(null);
        }
    }
Ejemplo n.º 14
0
        public override void UpdateStatus(FightStatus fightStatus)
        {
            PlayerType   playerType   = (PlayerType)(isLocalPlayer ? 13 : (((teamIndex == GameStatus.localPlayerTeamIndex) ? 1 : 2) | ((fightStatus == FightStatus.local) ? 4 : 0)));
            PlayerStatus playerStatus = new PlayerStatus(concernedEntity, fightStatus.fightId, index, teamId, teamIndex, name, playerType);

            fightStatus.AddEntity(playerStatus);
            playerStatus.SetCarac(CaracId.ActionPoints, baseActionPoints);
            if (isLocalPlayer)
            {
                fightStatus.localPlayerId = concernedEntity;
                CameraHandler current = CameraHandler.current;
                if (null != current)
                {
                    DirectionAngle mapRotation = GameStatus.GetMapRotation(playerStatus);
                    current.ChangeRotation(mapRotation);
                }
            }
            FightUIRework instance = FightUIRework.instance;

            if (null != instance)
            {
                AbstractPlayerUIRework abstractPlayerUIRework2 = playerStatus.view = ((!isLocalPlayer) ? ((AbstractPlayerUIRework)instance.AddPlayer(playerStatus)) : ((AbstractPlayerUIRework)instance.GetLocalPlayerUI(playerStatus)));
                abstractPlayerUIRework2.SetPlayerStatus(playerStatus);
                abstractPlayerUIRework2.SetPlayerName(playerStatus.nickname);
                abstractPlayerUIRework2.SetRankIcon(0);
                abstractPlayerUIRework2.SetActionPoints(baseActionPoints);
                abstractPlayerUIRework2.SetReservePoints(0);
                abstractPlayerUIRework2.SetElementaryPoints(0, 0, 0, 0);
            }
        }
Ejemplo n.º 15
0
        private static CastValidity ComputeCastValidity(ICastableStatus status)
        {
            PrecomputedData precomputedData = status.GetDefinition()?.precomputedData;
            FightStatus     local           = FightStatus.local;

            if (precomputedData != null && local != null)
            {
                PlayerStatus     player           = local.GetLocalPlayer();
                HeroStatus       heroStatus       = player.heroStatus;
                WeaponDefinition weaponDefinition = (WeaponDefinition)heroStatus.definition;
                if (precomputedData.checkNumberOfSummonings)
                {
                    int num            = local.EnumerateEntities((SummoningStatus s) => s.ownerId == player.id).Count();
                    int valueWithLevel = weaponDefinition.maxSummoningsOnBoard.GetValueWithLevel(heroStatus.level);
                    if (num >= valueWithLevel)
                    {
                        return(CastValidity.TOO_MANY_SUMMONING);
                    }
                }
                if (precomputedData.checkNumberOfMechanisms)
                {
                    int num2            = local.EnumerateEntities((MechanismStatus s) => s.ownerId == player.id).Count();
                    int valueWithLevel2 = weaponDefinition.maxMechanismsOnBoard.GetValueWithLevel(heroStatus.level);
                    if (num2 >= valueWithLevel2)
                    {
                        return(CastValidity.TOO_MANY_MECHANISM);
                    }
                }
            }
            return(CastValidity.SUCCESS);
        }
Ejemplo n.º 16
0
        private void OnEntitiesChanged(FightStatus fightStatus, EntitiesChangedFlags flags)
        {
            int fightId = fightStatus.fightId;
            FightMapMovementContext fightMapMovementContext = m_movementContexts[fightId];

            if ((flags & (EntitiesChangedFlags.Added | EntitiesChangedFlags.Removed | EntitiesChangedFlags.AreaMoved)) != 0 && m_activeMovementContext == fightMapMovementContext)
            {
                ICharacterEntity trackedCharacter = fightMapMovementContext.trackedCharacter;
                if (trackedCharacter != null)
                {
                    fightMapMovementContext.End();
                    if (!trackedCharacter.isDirty)
                    {
                        fightMapMovementContext.Begin(trackedCharacter, m_pathFinder);
                    }
                    else
                    {
                        m_activeMovementContext = null;
                    }
                    m_feedbackNeedsUpdate = true;
                }
            }
            if (m_targetContext != null && (flags & (EntitiesChangedFlags.Removed | EntitiesChangedFlags.AreaMoved)) != 0)
            {
                m_targetContext.Refresh();
                m_feedbackNeedsUpdate = true;
            }
            if (m_interactiveMode == InteractiveMode.Movement && m_localMovementContext == fightMapMovementContext)
            {
                m_cellPointerManager.RefreshPlayableCharactersHighlights(this, fightStatus);
            }
            m_inputHandler.SetDirty();
        }
 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");
     }
 }
 public override void UpdateStatus(FightStatus fightStatus)
 {
     if (fightStatus == FightStatus.local)
     {
         FightLogicExecutor.fightInitialized = true;
     }
 }
Ejemplo n.º 19
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");
     }
 }
Ejemplo n.º 20
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");
     }
 }
        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);
        }
Ejemplo n.º 22
0
        private static bool IsPathEmptyBetween(FightStatus fightStatus, Coord src, Coord dest, DynamicValueContext context)
        {
            //IL_0053: Unknown result type (might be due to invalid IL or missing references)
            if (!src.IsAlignedWith(dest))
            {
                return(false);
            }
            FightMapStatus mapStatus = fightStatus.mapStatus;

            foreach (Coord item in src.StraightPathUntil(dest))
            {
                switch (mapStatus.GetCellState(item.x, item.y))
                {
                case FightCellState.None:
                    return(false);

                default:
                    throw new ArgumentOutOfRangeException();

                case FightCellState.Movement:
                    break;
                }
                if (fightStatus.HasEntityBlockingMovementAt((Vector2Int)item))
                {
                    return(false);
                }
            }
            return(true);
        }
Ejemplo n.º 23
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);
 }
Ejemplo n.º 24
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if ((collision.tag == "Player" && src == BulletSource.enemy) ||
            (collision.tag == "Enemy" && src == BulletSource.player))
        {
            if (effectPrefab != null)
            {
                Instantiate(effectPrefab, transform.position, Quaternion.LookRotation(rb.velocity.normalized, Vector3.forward));
            }
            FightStatus fightStatus = collision.gameObject.GetComponent <FightStatus>();
            if (fightStatus)
            {
                fightStatus.Hurt(damage);
            }
            foreach (SpriteRenderer sr in srs)
            {
                sr.enabled = false;
            }
            rb.constraints = RigidbodyConstraints2D.FreezeAll;
            Destroy(gameObject, 1);

            if (hitSE)
            {
                hitSE.Play();
            }
        }
    }
 private void _SetFightResultFlag(bool win)
 {
     _fightStatus = FightStatus.FightResult;
     _roundStatus = RoundStatus.None;
     _view.SetFightEndFlag();
     _isWin = win;
 }
Ejemplo n.º 26
0
        protected override Color GetHighlightColor(FightMapFeedbackColors feedbackColors, IMapEntityProvider mapEntityProvider, ICharacterEntity trackedCharacter)
        {
            //IL_0045: Unknown result type (might be due to invalid IL or missing references)
            FightStatus local      = FightStatus.local;
            PlayerType  playerType = (local != mapEntityProvider) ? ((trackedCharacter.teamIndex == GameStatus.localPlayerTeamIndex) ? PlayerType.Ally : PlayerType.Opponent) : ((local.localPlayerId != trackedCharacter.ownerId) ? ((trackedCharacter.teamIndex == GameStatus.localPlayerTeamIndex) ? (PlayerType.Ally | PlayerType.Local) : (PlayerType.Opponent | PlayerType.Local)) : PlayerType.Player);

            return(feedbackColors.GetPlayerColor(playerType));
        }
Ejemplo n.º 27
0
        public override void UpdateStatus(FightStatus fightStatus)
        {
            FightUIRework instance = FightUIRework.instance;

            if (null != instance)
            {
                instance.EndTurn();
            }
        }
Ejemplo n.º 28
0
 protected AbstractFightAdminCommand(string name, KeyCode key)
 {
     //IL_0007: Unknown result type (might be due to invalid IL or missing references)
     //IL_0008: Unknown result type (might be due to invalid IL or missing references)
     this.key      = key;
     this.name     = name;
     m_fightStatus = FightStatus.local;
     m_fightMap    = FightMap.current;
 }
Ejemplo n.º 29
0
 protected CastTargetContext(FightStatus fightStatus, int playerId, DynamicValueHolderType type, int spellDefinitionId, int level, int instanceId, int expectedTargetCount)
     : base(fightStatus, playerId, type, level)
 {
     this.spellDefinitionId   = spellDefinitionId;
     this.expectedTargetCount = expectedTargetCount;
     this.instanceId          = instanceId;
     selectedTargetCount      = 0;
     m_targets = new Target[expectedTargetCount];
 }
Ejemplo n.º 30
0
 public void ComboWating(float comboWaitTime, FightStatus fightStatus, bool isPlayer)
 {
     if (isPlayer)
     {
         comboSliderGO.gameObject.SetActive(true);
         comboSlider.fillAmount = 1f;
     }
     StartCoroutine(ComboWatingCoroutine(comboWaitTime, fightStatus, isPlayer));
 }
Ejemplo n.º 31
0
        public void Update(double gameTime, SimpleMouseState mState, SimpleKeyboardState kState)
        {
            mouseState = mState;
            keyState = kState;
            mGameTime = gameTime;
            if (mouseState.right && mouseState.getPos().Y < 550) {
                tryImoveHere(selected, new Vector2f(mouseState.getPos().X, mouseState.getPos().Y), gameTime);
            }
            if (keyState.IsKeyDown(RESTART_KEY)) {//restart
                GameBox.getInstance().doLastBossFight();
            }
            if (keyState.IsKeyDown(Keyboard.Key.F1) && !prevKeyState.IsKeyDown(Keyboard.Key.F1)) {//lose fight
                if (fightStatus == FightStatus.fightEngaged || fightStatus == FightStatus.preFight) {
                    fightStatus = FightStatus.fightLost;
                    timer = new Timer(gameTime);
                } else {
                    GameBox.getInstance().initPostFight(bossFight.getFightID(), finalTime, getPlayerAmt(), damageMeter, fightStatus == FightStatus.fightWon, bossFight.getBossInfo().enragetimer,thisRaid);
                }
            }
            if (fightStatus == FightStatus.fightEngaged || fightStatus == FightStatus.preFight) {//stop updatings stuff after fight for now, later we might have mobs move around after
                foreach (Moveable m in moveables) {
                    m.Update(gameTime);
                    m.updateBuffs(gameTime);
                    //EFF check if i need all these checks inside this forloop
                    if (mouseState.left) {
                        if (targetNeeded && currentCursor == targetTexture && selected is PlayerClassI && m.isInMe(mouseState.getPos().X, mouseState.getPos().Y)) {//if looking for target
                            PlayerClassI p = (PlayerClassI)selected;
                            if (!targetAll)
                                p.setTarget(m, gameTime);
                            else
                                setAllPlayersTarget(m, gameTime);
                            targetNeeded = false;
                            targetAll = false;
                            currentCursor = null;
                        } else if (mouseState.DoneClickedIt(mouseButton.LEFT) && m.isInMe(mouseState.getPos().X, mouseState.getPos().Y)) {
                            //selection happens right here
                            //selected = m;
                            setSelected(m);
                        }
                    }
                }
            }
            if (kState.IsKeyDown(RAID_TAB_KEY) && !prevKeyState.IsKeyDown(RAID_TAB_KEY)){
                //if we hit *TAB* select next person in raid? (maybe closest ?)
                if(selected != null){
                    int index = moveables.IndexOf(selected);
                    do{
                        index = (index + 1) % moveables.Count;
                    }while(moveables[index] is Enemy);
                    setSelected(moveables[index]);
                }
            }
            if (selected is PlayerClassI && kState.IsKeyDown(TARGET_KEY) && !prevKeyState.IsKeyDown(TARGET_KEY)) {
                if (!targetNeeded) {
                    targetNeeded = true;
                    currentCursor = targetTexture;
                } else {
                    targetNeeded = false;
                    currentCursor = null;
                }
            }
            if (selected is PlayerClassI && kState.IsKeyDown(TARGETALL_KEY) && !prevKeyState.IsKeyDown(TARGETALL_KEY)) {
                if (!targetAll) {
                    targetNeeded = true;
                    targetAll = true;
                    currentCursor = targetTexture;
                } else {
                    targetNeeded = false;
                    targetAll = false;
                    currentCursor = null;
                }
            }
            if (selected is PlayerClassI && kState.IsKeyDown(USE_KEY) && !prevKeyState.IsKeyDown(USE_KEY)) {
                ((PlayerClassI)selected).doAbility();
            }

            foreach (Projectile p in projectiles) {
                p.Update(gameTime);
                if (p.doesCollide() ) {
                    foreach(PlayerClassI m in getAlivePlayerMoveables()){
                        if(p.getOwner() != m && m.isInMe(p.getMid()))
                            projectilesToRemove.Add(p);
                    }

                }
            }
            foreach (GroundEffect g in groundEffects) {
                if (g.update(gameTime)) {//if thats true, do groundfire
                    if (g.doAbility == null) {
                        removeGroundEffect(g);
                        continue;
                    }
                    List<PlayerClassI> peopleGotHit = new List<PlayerClassI>();
                    foreach (PlayerClassI p in getPlayerMoveables()) {
                        //add people to list near fire
                        if( Math.Sqrt(Math.Pow(p.getMid().X-g.getMid().X,2) + Math.Pow(p.getMid().Y-g.getMid().Y,2)) < 13){
                            peopleGotHit.Add(p);
                        }
                    }
                    foreach(PlayerClassI p in peopleGotHit){
                        g.doAbility(p);
                    }
                    removeGroundEffect(g);
                }
            }
            //clean up
            foreach (Projectile p in projectilesToRemove) {
                projectiles.Remove(p);
            }
            projectilesToRemove.Clear();
            foreach (GroundEffect g in groundEffectsToRemove) {
                groundEffects.Remove(g);
            }
            groundEffectsToRemove.Clear();
            foreach (Projectile p in projectilesToAdd) {
                projectiles.Add(p);
            }
            projectilesToAdd.Clear();
            //check if boss enrages
            if (fightStatus == FightStatus.fightEngaged && !bossEnraged && timer.getTime(gameTime) > bossFight.getBossInfo().enragetimer) {
                bossFight.setEnraged(true);
                bossEnraged = true;
            }

            //end game stuffs
            if (fightStatus == FightStatus.fightEngaged) {
                //check to see if either side has won
                if (bossFight.isBossFightDead()) {//bossdead
                    finalTime = timer.getFormattedTime(gameTime,3);
                    fightStatus = FightStatus.fightWon;
                    //addScreenNote(bossFight.getBossInfo().deathstring); TODO
                    //start timer to go to post game
                    timer.reset(gameTime);
                } else if (!areAnyPlayersAlive()) {//peopledead
                    finalTime = timer.getFormattedTime(gameTime,3);
                    fightStatus = FightStatus.fightLost;
                    //start timer to go to post game
                    timer.reset(gameTime);
                }
            }
            raidFrames.checkClicks(mouseState);
            if (fightStatus == FightStatus.fightLost || fightStatus == FightStatus.fightWon) {
                if (timer.getTime(gameTime) > TIMETILPOSTGAME) {
                    GameBox.getInstance().initPostFight(bossFight.getFightID(), finalTime, getPlayerAmt(), damageMeter, fightStatus == FightStatus.fightWon, bossFight.getBossInfo().enragetimer, thisRaid);
                }
            }
            //scripts
            if(fightStatus == FightStatus.fightEngaged)
                updateScripts(gameTime);
            //backdrops
            if (bUpdate = mBackdrop.update(gameTime, 600))//TODO make its so it moves ya know
                bUpdate = false;
            //objects? but this should be near other important stuff
            foreach (FightObject ob in fightObjects)
                ob.update(gameTime);

            prevMouseState = mouseState;
            prevKeyState = kState;
        }
Ejemplo n.º 32
0
 internal void startBossFight()
 {
     if (fightStatus != FightStatus.preFight) return;
     //start timer, and check to see if you killed boss in Update loop
     //if you killed boss, send display a win string on the screen and then start post screen
     timer = new Timer(mGameTime);
     fightStatus = FightStatus.fightEngaged;
     //reset boss cd's
     /*List<Enemy> enemies = getAliveEnemyMoveables();
     foreach (Enemy e in enemies) {
         e.resetCooldowns(mGameTime);
     }*/
     GameBox.getInstance().save();//for fun
     thisRaid = PositionFactory.getRaidSetup(getAlivePlayerMoveables());
     GameBox.getInstance().setLastRaid(thisRaid);
 }