Exemple #1
0
        public Boolean CanDoCommand(Command p_command, Int32 p_character)
        {
            Party      party      = LegacyLogic.Instance.WorldManager.Party;
            BaseAction baseAction = m_actions[p_character][(Int32)p_command.Type];

            return(baseAction != null && !party.FightRoundDone() && !m_waitFinishActions && baseAction.ActionAvailable() && baseAction.CanDoAction(p_command));
        }
Exemple #2
0
        private void ProcessCommand(Command p_command)
        {
            Party      party      = LegacyLogic.Instance.WorldManager.Party;
            BaseAction baseAction = m_actions[party.CurrentCharacter][(Int32)p_command.Type];

            if (baseAction.ActionAvailable())
            {
                if (baseAction.CanDoAction(p_command))
                {
                    if (!baseAction.CanBeDelayedByLock() || m_lock == null)
                    {
                        baseAction.DoAction(p_command);
                        m_activeActions.Add(baseAction);
                        if (baseAction.ConsumeType == BaseAction.EConsumeType.CONSUME_CHARACTER_TURN)
                        {
                            if (party.HasAggro())
                            {
                                Boolean flag = false;
                                if (party.SelectedCharacter.Class.IsBlademaster() && baseAction is MeleeAttackAction && (baseAction as MeleeAttackAction).MonsterWasKilled)
                                {
                                    flag = true;
                                    party.AutoSelectMonster();
                                    (baseAction as MeleeAttackAction).MonsterWasKilled = false;
                                    if (party.SelectedMonster != null)
                                    {
                                        ExtraAttackEventArgs p_args = new ExtraAttackEventArgs(party.SelectedCharacter);
                                        party.SelectedCharacter.FightHandler.FeedActionLog(p_args);
                                    }
                                }
                                if (!flag && !m_turnsReseted)
                                {
                                    party.FinishCurrentCharacterTurn();
                                }
                            }
                        }
                        else if (baseAction.ConsumeType == BaseAction.EConsumeType.CONSUME_PARTY_TURN)
                        {
                            if (baseAction is InteractAction)
                            {
                                m_interactionOnlyRound = true;
                            }
                            party.FinishPartyRound();
                        }
                        CheckInCombat(false);
                        LegacyLogic.Instance.EventManager.InvokeEvent(this, EEventType.UPDATE_AVAILABLE_ACTIONS, EventArgs.Empty);
                    }
                    else
                    {
                        m_delayedCommand = p_command;
                        m_lock();
                    }
                }
                else
                {
                    baseAction.DontDoAction(p_command);
                    p_command.CancelCommand();
                }
            }
            else
            {
                p_command.CancelCommand();
                if (LegacyLogic.Instance.WorldManager.Party.InCombat)
                {
                    Command.ECommandTypes type = p_command.Type;
                    if (type != Command.ECommandTypes.MOVE)
                    {
                        if (type == Command.ECommandTypes.REST)
                        {
                            LegacyLogic.Instance.CharacterBarkHandler.RandomPartyMemberBark(EBarks.CANT_ACT);
                        }
                    }
                    else
                    {
                        LegacyLogic.Instance.CharacterBarkHandler.RandomPartyMemberBark(EBarks.CANT_ACT);
                    }
                }
                if (LegacyLogic.Instance.WorldManager.Party.HasAggro())
                {
                    Command.ECommandTypes type = p_command.Type;
                    if (type != Command.ECommandTypes.INTERACT)
                    {
                        if (type == Command.ECommandTypes.REST)
                        {
                            LegacyLogic.Instance.CharacterBarkHandler.RandomPartyMemberBark(EBarks.REST_DANGER);
                        }
                    }
                    else
                    {
                        LegacyLogic.Instance.CharacterBarkHandler.RandomPartyMemberBark(EBarks.CANT_ACT);
                    }
                }
            }
        }