コード例 #1
0
    public void UpdateLate()
    {
        if (null == _addSkillCommand || _addSkillCommand.Count == 0)
        {
            return;
        }
        while (_addSkillCommand.Count > 0)
        {
            SkillCommand command = _addSkillCommand[0];
            _addSkillCommand.RemoveAt(0);
            if (null != command)
            {
                ICharaBattle battleInfo = ZTBattleSceneManager.GetInstance().GetCharaById(command.BattleId) as ICharaBattle;

                if (null == battleInfo)
                {
                    return;
                }

                if (!_skillParserDic.ContainsKey(command.BattleId))
                {
                    _skillParserDic.Add(command.BattleId, new List <SkillActionParser>());
                }
                SkillActionParser skillParser = new SkillActionParser(battleInfo, command);
                _skillParserDic[battleInfo.BattleId].Add(skillParser);
            }
        }
    }
コード例 #2
0
    public void DoColliderAction(ICharaBattle player)
    {
        _colliderCount++;
        if (_colliderInfo.ColliderMax != -1 && _colliderCount >= _colliderInfo.ColliderMax)
        {
            Complete();
            return;
        }
        if (null != _colliderInfo.FightEffectList && _colliderInfo.FightEffectList.Count > 0)
        {
            Vector3 dir = new Vector3(_collider.x, 0, _collider.y);
            dir = (player.MovePos - dir).normalized;

            for (int i = 0; i < _colliderInfo.FightEffectList.Count; i++)
            {
                FightEffectInfo info = _colliderInfo.FightEffectList[i];
                if (info.EffectTarget == FIGHT_EF_TARGET.SELF)
                {
                    FightEffectDefine.ParseEffect(_skillPlayer, info, _skillPlayer.BattleId, dir);
                }
                else
                {
                    SkillCommand command = null;
                    if (info.EffectType == FIGHT_EF_TPYE.ACTION)
                    {
                        uint frame = ZTBattleSceneManager.GetInstance().SceneFrame;
                        command = FightDefine.GetSkillCommand(player.BattleId, frame, info.Param1, dir, player.MovePos);
                    }
                    FightEffectDefine.ParseEffect(player, info, _skillPlayer.BattleId, dir, command);
                }
            }
        }
    }
コード例 #3
0
        internal void Skill(uint entityId, int skillId)
        {
            SkillCommand cmd = CommandManager.Instance.CreateCommand("skill") as SkillCommand;

            cmd.Load(entityId, skillId);
            cmd.Execute(m_Instance, m_DeltaTime);
        }
コード例 #4
0
    public void ReceiveSkillCommand(SkillCommand inCommand)
    {
        activeSkillCommand = inCommand;

        //deduct mp
        if (!GameContext.DEBUG_INFINITE_MP)
        {
            activeSkillCommand.source.SpendMp(activeSkillCommand.skill.mpCost);
        }

        //if it's not a friendly skill always move to face the first target
        if (!activeSkillCommand.skill.isFriendly && activeSkillCommand.targets.Count > 0)
        {
            CharacterData source = activeSkillCommand.source;
            CharacterData target = activeSkillCommand.targets[0];

            float sourceX = source.spawnPosition.x;
            float targX   = target.spawnPosition.x;
            if (targX > sourceX && source.direction == Direction.LEFT ||
                targX < sourceX && source.direction == Direction.RIGHT)
            {
                source.FlipDirection();
            }
        }
    }
コード例 #5
0
        private static void OnSkillUsed(Adventure inAdventure, SkillCommand inCommand)
        {
            var targetId     = inCommand.targets[0].id;
            var targetNumber = inCommand.targets[0].orderInTeam;

            Console.WriteLine($"{inCommand.source.id} used skill {inCommand.skill.id} on {targetId} [position {targetNumber}]");
        }
コード例 #6
0
ファイル: ActiveSkillButton.cs プロジェクト: mkecman/GameOne
 void Start()
 {
     _skillCommand = GameModel.Get <SkillCommand>();
     _pay          = GameModel.Get <CompoundPaymentService>();
     GameModel.HandleGet <PlanetModel>(OnPlanetChange);
     GameModel.HandleGet <UnitModel>(OnUnitChange);
 }
コード例 #7
0
ファイル: SkillInit.cs プロジェクト: x3sphiorx/SagaRO2
 private static void AddSub(SkillIDs baseskill, int levels, SkillCommand func)
 {
     for (int i = 0; i < levels; i++)
     {
         SkillCommands.Add((SkillIDs)((int)baseskill + i), func);
     }
 }
コード例 #8
0
 public SkillActionParser(ICharaBattle playerBase, SkillCommand command)
 {
     SkillPlayer     = playerBase;
     Command         = command;
     _skillActionDic = new Dictionary <uint, List <SkillActionBase> >();
     IsComplete      = false;
     ParseSkillAction();
 }
コード例 #9
0
 //使用技能
 public void SkillCommand(SkillCommand command)
 {
     if (CanUseSkill() && null != command)
     {
         //BattleState = BATTLE_STATE.SKILL;
         SceneEvent.GetInstance().dispatchEvent(SCENE_EVENT.ADD_SKILL_PARSER, new Notification(command));
     }
 }
コード例 #10
0
ファイル: Animal.cs プロジェクト: kauhiant/Unity_3DMaze
        // 追擊某個敵人.直到某些狀況才結束.(未完成)
        private void Battle(Animal enemy)
        {
            skillCommand = DetermineSkill(enemy.position);

            if (skillCommand == SkillCommand.None)
            {
                Wander();
            }
        }
コード例 #11
0
 public void Execute(CharacterData inActiveCharacter, Adventure inAdventure, SkillCommand inCommandToPopulate)
 {
     //use triggers if they exist instead of regular psuedocode commands
     if (triggers.Count > 0)
     {
         ExecuteTriggers(inActiveCharacter, inAdventure, inCommandToPopulate);
         return;
     }
 }
コード例 #12
0
    private static void DoAction(ICharaBattle battleInfo, FightEffectInfo effect, uint userId = 0, Vector3 dir = default(Vector3), object takeParam = null)
    {
        SkillCommand skill = takeParam as SkillCommand;

        if (null != skill && null != battleInfo)
        {
            battleInfo.SkillCommand(skill);
        }
    }
コード例 #13
0
        public override void OnEnter()
        {
            base.OnEnter();

            obj_skill_command.Value.gameObject.SetActive(true);

            skillCommand = obj_skill_command.Value.GetComponent <SkillCommand>();

            skillCommand.OnCancel.AddListener(HandleCancel);
            skillCommand.OnSelectedSkillIndex.AddListener(HandleSelectedSkillIndex);
        }
コード例 #14
0
    public SkillCommand PopulateAISkillCommand(SkillCommand inCommand, CharacterTeam opposingTeam)
    {
        //right now always choose a random target
        CharacterData target = opposingTeam.GetRandomLivingMember();

        Skill skillToUse = GetDefaultSkill();

        inCommand.Reset(skillToUse, this);
        inCommand.AddTarget(target);
        return(inCommand);
    }
コード例 #15
0
 // Command를 할수 있는지 없는지만 검사합니다.
 // 생성자대용으로 사용합니다.
 public static bool CreateCommand(Unit unit, Cube target, out SkillCommand skillCommand)
 {
     if (MapMgr.Instance.IsInRange(unit.skill.skillRange, unit.GetCube, target))
     {
         skillCommand = new SkillCommand(target);
         return(true);
     }
     else
     {
         skillCommand = null;
         return(false);
     }
 }
コード例 #16
0
ファイル: UnitController.cs プロジェクト: mkecman/GameOne
    public void Init()
    {
        _factory                  = GameModel.Get <UnitFactory>();
        _skillCommand             = GameModel.Get <SkillCommand>();
        _unitDefenseUpdateCommand = GameModel.Get <UnitDefenseUpdateCommand>();
        _unitUseCompoundCommand   = GameModel.Get <UnitUseCompoundCommand>();

        GameModel.HandleGet <PlanetModel>(OnPlanetChange);

        GameMessage.Listen <HexClickedMessage>(OnHexClickedMessage);
        //GameMessage.Listen<ClockTickMessage>( OnClockTick );
        GameMessage.Listen <ResistanceUpgradeMessage>(OnResistanceUpgrade);
        GameMessage.Listen <UnitPropUpgradeMessage>(OnUnitPropUpgradeMessage);
        GameMessage.Listen <UnitUseCompoundMessage>(OnUnitUseCompoundMessage);
        GameMessage.Listen <UnitSelectMessage>(OnUnitSelectMessage);
        GameMessage.Listen <UnitAddMessage>(OnUnitAddMessage);
    }
コード例 #17
0
ファイル: ActiveSkillButton.cs プロジェクト: mkecman/GameOne
    public override void OnDestroy()
    {
        base.OnDestroy();

        GameModel.RemoveHandle <PlanetModel>(OnPlanetChange);
        GameModel.RemoveHandle <UnitModel>(OnUnitChange);
        GameMessage.StopListen <SkillDeactivateAllMessage>(OnSkillDeactivate);

        _tooltipMessage.Action = TooltipAction.HIDE;
        GameMessage.Send(_tooltipMessage);

        _life              = null;
        _skillCommand      = null;
        _pay               = null;
        _tooltipMessage    = null;
        _deactivateMessage = null;
        _unit              = null;
    }
コード例 #18
0
    // Use this for initialization
    void Start()
    {
        //메모리풀 세팅
        MemoryPoolManager.Instance.SetObject("ThrowMesh", 1);
        MemoryPoolManager.Instance.SetObject("BashEffect", 1);
        MemoryPoolManager.Instance.SetObject("BuffEffect", 1, FxCenter);
        MemoryPoolManager.Instance.SetObject("RecoveryHP", 10, FxCenter);
        MemoryPoolManager.Instance.SetObject("RecoveryMP", 10, FxCenter);

        PlayerIO.LoadData();

        moveCommand = new MoveCommand();

        for (int i = 0; i < 7; i++)
        {
            SkillCommands[i] = new SkillCommand(i);
        }
    }
コード例 #19
0
    => true;     // 범위내의 모든 큐브에 Cast가능합니다.

    private void CastSkillOnCube(Cube cubeClicked)
    {
        this.cubeClicked = cubeClicked;

        TurnMgr_State_ nextState = new TurnMgr_PlayerBegin_(owner, unit);

        owner.stateMachine.ChangeState(
            new TurnMgr_WaitSingleEvent_(
                owner, unit, EventMgr.Instance.onUnitSkillExit, nextState,
                (param) => ((UnitStateEvent)param)._owner == unit),
            StateMachine <TurnMgr> .StateTransitionMethod.JustPush);

        unit.StopBlink();

        SkillCommand skillCommand;

        if (SkillCommand.CreateCommand(unit, cubeClicked, out skillCommand))
        {
            unit.EnqueueCommand(skillCommand);
        }
    }
コード例 #20
0
    public IEnumerator Skill(SkillCommand skillCommand)
    {
        BattleCharacter owner        = skillCommand.owner;
        string          skillName    = skillCommand.skillData.skillName;
        int             skillMp      = skillCommand.skillData.mp;
        string          skillMessage = skillCommand.owner.CharacterName + "は" + skillName + "をつかった";

        yield return(StartCoroutine(message.ShowAuto(skillMessage)));

        if (owner.status.mp <= skillMp)
        {
            yield return(StartCoroutine(message.ShowAuto("しかし MPが たりない!")));

            yield break;
        }

        owner.GainMp(skillMp);
        yield return(StartCoroutine(effectExecutor.Execution(skillCommand)));

        yield break;
    }
コード例 #21
0
ファイル: Animal.cs プロジェクト: kauhiant/Unity_3DMaze
        // 在家附近巡邏.不會離太遠.
        private void Patrol(Creater home)
        {
            Point2D  temp   = this.posit.Copy();
            Vector2D target = RandomVector(10);

            for (int i = 0; i < 4; ++i)
            {
                temp.MoveFor(target, 1);
                if (temp.DistanceTo(home.position) > patrolDist)
                {
                    temp.MoveFor(target, -1);
                    target = VectorConvert.Rotate(target);
                }
                else
                {
                    moveCommamd = Convert(target);
                    return;
                }
            }

            skillCommand = SkillCommand.None;
            patrolDist   = this.posit.DistanceTo(home.position);
        }
コード例 #22
0
    private List <CharacterData[]> pendingCharacterTransformations; //this is NOT for transmuting. this is for when a character "dies" and turns into another

    public BattleManager(Adventure inAdventure)
    {
        adventure = inAdventure;

        curFile = SaveFile.GetSaveFile();

        charactersInBattle              = new List <CharacterData>();
        turnQueue                       = new List <CharacterData>();
        currentSkillResults             = new List <SkillResult>();
        currentDeadCharacters           = new List <CharacterData>();
        pendingCharacterTransformations = new List <CharacterData[]>();

        cachedSkillCommand = new SkillCommand();

        stepsInATurn = new List <Action>();
        stepsInATurn.Add(EnactPendingCharacterTransformations);
        stepsInATurn.Add(BeginTurn);
        stepsInATurn.Add(CheckForRegenProc);
        stepsInATurn.Add(ActivateNextCharacter);
        stepsInATurn.Add(RequestActiveCharacterInput);
        stepsInATurn.Add(ResolveActiveSkillCommand);
        stepsInATurn.Add(CleanupActiveSkillCommand);
        stepsInATurn.Add(DeactivateActiveCharacter);
        stepsInATurn.Add(CheckForStatusProc);
        stepsInATurn.Add(CheckForDeaths);
        stepsInATurn.Add(EarnLootForDeadEnemies);
        stepsInATurn.Add(EndTurn);
        stepsInATurn.Add(CheckForPlayerTeamRevive);
        stepsInATurn.Add(CheckForBattleEnd);
        stepsInATurn.Add(Repeat);


        defaultEnemyScript = SodaScript.GetPremadeScript(SodaScript.SCRIPT_DEFAULT_ENEMY);

        playerTeamHasRevivedOnceThisTrip = false;
    }
コード例 #23
0
        //--------------------------------------------------

        public void Move(Character pUser, CInPacket iPacket)
        {
            // TODO: Set person whose client sent this as controller ( they may not be )
            //Recv [CP_MobMove] [E3 00] [11 27 00 00] [12 00] 00 1D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 CC DD FF 00 CC DD FF 00 BA 16 D8 40 09 05 5E 00 00 00 00 00 01 00 09 05 5E 00 00 00 00 00 DC 00 00 00 00 00 05 38 04 00 09 05 5E 00 09 05 5E 00 01 01 01 00 9A 48 03 00

            var pMonster = this[iPacket.Decode4()];

            // TODO don't block the packet if the sender isnt the controller
            if (pMonster == null || pMonster.Controller.dwId != pUser.dwId)
            {
                return;
            }

            var nMobCtrlSN = iPacket.Decode2();
            var dwFlag     = iPacket.Decode1();            // bSomeRand | 4 * (bRushMove | 2 * (bRiseByToss | 2 * nMobCtrlState));

            var bNextAttackPossible = (dwFlag & 0xF) != 0; // BMS

            var nActionAndDir = iPacket.Decode1();

            var dwData = iPacket.Decode4();             // !CMob::DoSkill(v7, (unsigned __int8)dwData, BYTE1(dwData), dwData >> 16)

            var nMultiTargetSize = iPacket.Decode4();

            for (int i = 0; i < nMultiTargetSize; i++)
            {
                iPacket.Decode4();                 //aMultiTargetForBall[i].x
                iPacket.Decode4();                 //aMultiTargetForBall[i].y
            }

            var nRandTimeSize = iPacket.Decode4();

            for (int i = 0; i < nRandTimeSize; i++)
            {
                iPacket.Decode4();                 //m_aRandTimeforAreaAttack[i]
            }

            var nMoveFlags = iPacket.Decode1();

            iPacket.Decode4();             //CVecCtrlMob::GetHackedCode
            iPacket.Decode4();             //CVecCtrlMob::MoveContext::FlyContext->ptTargey.x
            iPacket.Decode4();             //CVecCtrlMob::MoveContext::FlyContext->ptTargey.y
            iPacket.Decode4();             //dwHackedCodeCRC

            // TODO change controller logic
            //if (mob.getController().getUser() != ctrl && ((mobCtrlState & 0xF0) == 0 || mob.isNextAttackPossible()
            //	|| !lifePool.changeMobController(ctrl.getCharacterID(), mob, true)))
            //{
            //	mob.sendChangeControllerPacket(ctrl, (byte)0);
            //	return;
            //}

            var nAction = (byte)(nActionAndDir == 0xFF             // -1
                                ? 0xFF : nActionAndDir >> 1);

            var skillCommand = new SkillCommand();             // populated by OnMobMove()

            if (pMonster.OnMobMove(bNextAttackPossible, nAction, dwData, skillCommand))
            {
                pUser.SendPacket(CPacket.CMobPool.MobMoveAck(pMonster.dwId, nMobCtrlSN, bNextAttackPossible, pMonster.Stats.MP, skillCommand));

                var oPacket = CPacket.CMobPool.MobMove(pMonster.dwId, bNextAttackPossible, nActionAndDir, dwData);

                var len = pMonster.Position.UpdateMovePath(oPacket, iPacket); // decode & encode movepath

                iPacket.Decode1();                                            // bChasing
                iPacket.Decode1();                                            // pTarget != 0
                iPacket.Decode1();                                            // bChasing
                iPacket.Decode1();                                            // bChasingHack
                iPacket.Decode4();                                            // tChaseDuration

                if (len > 0)
                {
                    Field.Broadcast(oPacket, pUser);
                }
            }
        }
コード例 #24
0
ファイル: BattleSkillInput.cs プロジェクト: bmjoy/Unity2DRPG
    public void OnClick(SkillData skillData)
    {
        SkillCommand skill = new SkillCommand(skillData);

        BattleInputController.instance.SelectCommand(skill);
    }
コード例 #25
0
    private void OnAddSkillParser(Notification data)
    {
        SkillCommand command = (data.param) as SkillCommand;

        _addSkillCommand.Add(command);
    }
コード例 #26
0
    public void ExecuteTriggers(CharacterData inActiveCharacter, Adventure inAdventure, SkillCommand inCommandToPopulate)
    {
        //store some data up front that will probably be useful
        activeCharacter = inActiveCharacter;
        adventure       = inAdventure;
        opposingTeam    = inAdventure.GetTeamOppositeOfFaction(activeCharacter.curFaction);
        ownTeam         = inAdventure.GetTeamForFaction(activeCharacter.curFaction);

        if (potentialTargets == null)
        {
            potentialTargets = new List <CharacterData>();
        }
        if (culledTargets == null)
        {
            culledTargets = new List <CharacterData>();
        }

        potentialSkill = null;

        //for a trigger to eval it needs a valid target, and the ability to cast the requested spell
        bool atLeastOneTriggerEvaluated = false;

        for (int i = 0; i < triggers.Count; i++)
        {
            if (EvalTrigger(triggers[i], inCommandToPopulate))
            {
                atLeastOneTriggerEvaluated = true;
                break;
            }
        }

        //if we made it this far, fall back to the default trigger that will always fire
        if (!atLeastOneTriggerEvaluated)
        {
            EvalTrigger(defaultTrigger, inCommandToPopulate);
        }


        //cleanup
        potentialTargets.Clear();
        culledTargets.Clear();
        potentialSkill = null;
    }
コード例 #27
0
    private bool EvalTrigger(SodaScriptTrigger inTrigger, SkillCommand inCommandToPopulate)
    {
        //is this a trigger with a percentage chance? if so start with that since it can save us processing time
        if (inTrigger.percentageChance < 100)
        {
            if (!Utils.PercentageChance(inTrigger.percentageChance))
            {
                return(false);
            }
        }

        potentialTargets.Clear();
        culledTargets.Clear();

        CharacterData curTarget = null;

        if (inTrigger.target == SodaScriptTarget.SELF)
        {
            potentialTargets.Add(activeCharacter);
        }
        else if (inTrigger.target == SodaScriptTarget.ALLY)
        {
            for (int i = 0; i < ownTeam.members.Count; i++)
            {
                curTarget = ownTeam.members[i];
                if (!curTarget.dead && curTarget != activeCharacter)
                {
                    potentialTargets.Add(curTarget);
                }
            }
        }
        else if (inTrigger.target == SodaScriptTarget.ENEMY)
        {
            for (int i = 0; i < opposingTeam.members.Count; i++)
            {
                curTarget = opposingTeam.members[i];
                if (!curTarget.dead)
                {
                    potentialTargets.Add(curTarget);
                }
            }
        }

        //we might not even have a list of *potential* targets! (this would happen in a case when we try target an ally but we're the only member on the team)
        if (potentialTargets.Count == 0)
        {
            return(false);
        }

        //eval the condition on our list
        if (inTrigger.condition == SodaScriptCondition.ANY)
        {
            curTarget = potentialTargets.GetRandomElement();
            potentialTargets.Clear();
            potentialTargets.Add(curTarget);
        }
        else
        {
            //default to a normal eval
            EvalCondition(inTrigger.condition, inTrigger.comparison, inTrigger.compareValue, potentialTargets);
        }

        //exit if no potentials found yet
        if (potentialTargets.Count == 0)
        {
            return(false);
        }

        //do we have to check a secondary condition?
        if (inTrigger.hasSecondaryCondition)
        {
            EvalCondition(inTrigger.secondaryCondition, inTrigger.secondaryComparison, inTrigger.secondaryCompareValue, potentialTargets);
        }

        //did we find a valid target? if not, return false
        if (potentialTargets.Count == 0)
        {
            return(false);
        }

        //fix some issues when targetting self and requesting certain skill categories, turn into strongest *self* heal (avoids issues with first aid)
        if (inTrigger.target == SodaScriptTarget.SELF)
        {
            if (inTrigger.skillCategory == SodaScriptSkillCategory.STRONGEST_HEAL)
            {
                inTrigger.skillCategory = SodaScriptSkillCategory.STRONGEST_SELF_HEAL;
            }

            if (inTrigger.skillCategory == SodaScriptSkillCategory.ANY_BUFF)
            {
                inTrigger.skillCategory = SodaScriptSkillCategory.ANY_SELF_BUFF;
            }
        }

        //is the skill also valid? if not, return false
        if (inTrigger.skillCategory == SodaScriptSkillCategory.DEFAULT)
        {
            potentialSkill = activeCharacter.GetDefaultSkill();
        }
        else if (inTrigger.skillCategory == SodaScriptSkillCategory.SPECIFIC)
        {
            potentialSkill = Skill.GetSkill(inTrigger.skillId);
        }
        else if (inTrigger.skillCategory == SodaScriptSkillCategory.ANY_NON_FRIENDLY_THAT_CONSUMES_MP)
        {
            potentialSkill = activeCharacter.GetAnyNonFriendlySkillThatUsesMP();
        }
        else if (inTrigger.skillCategory == SodaScriptSkillCategory.ANY_NON_FRIENDLY_THAT_DOESNT_CONSUME_MP)
        {
            potentialSkill = activeCharacter.GetAnyNonFriendlySkillThatDoesntUseMP();
        }
        else if (inTrigger.skillCategory == SodaScriptSkillCategory.ANY)
        {
            potentialSkill = activeCharacter.GetRandomUsableSkill();
        }
        else if (inTrigger.skillCategory == SodaScriptSkillCategory.STRONGEST_SELF_HEAL)
        {
            potentialSkill = activeCharacter.GetStrongestUsableHealSkill(false, true);
        }
        else if (inTrigger.skillCategory == SodaScriptSkillCategory.STRONGEST_HEAL)
        {
            potentialSkill = activeCharacter.GetStrongestUsableHealSkill(false, false);
        }
        else if (inTrigger.skillCategory == SodaScriptSkillCategory.STRONGEST_GROUP_HEAL)
        {
            potentialSkill = activeCharacter.GetStrongestUsableHealSkill(true, false);
        }
        else if (inTrigger.skillCategory == SodaScriptSkillCategory.STRONGEST_ATTACK)
        {
            potentialSkill = activeCharacter.GetStrongestUsableDamageSkill(false);
        }
        else if (inTrigger.skillCategory == SodaScriptSkillCategory.STRONGEST_GROUP_ATTACK)
        {
            potentialSkill = activeCharacter.GetStrongestUsableDamageSkill(true);
        }
        else if (inTrigger.skillCategory == SodaScriptSkillCategory.STRONGEST_SINGLE_TARGET_ATTACK)
        {
            potentialSkill = activeCharacter.GetStrongestUsableDamageSkill(false, true);
        }
        else if (inTrigger.skillCategory == SodaScriptSkillCategory.ANY_BUFF)
        {
            potentialSkill = activeCharacter.GetAnySkillThatBuffs();
        }
        else if (inTrigger.skillCategory == SodaScriptSkillCategory.ANY_SELF_BUFF)
        {
            potentialSkill = activeCharacter.GetAnySkillThatSelfBuffs();
        }
        else if (inTrigger.skillCategory == SodaScriptSkillCategory.ANY_DEBUFF)
        {
            potentialSkill = activeCharacter.GetAnySkillThatDebuffs();
        }
        else
        {
            throw new Exception("Skill category " + inTrigger.skillCategory + " is not supported");
        }

        if (potentialSkill == null)
        {
            return(false);
        }

        if (!activeCharacter.CanUseSkill(potentialSkill.id))
        {
            return(false);
        }


        //make sure we're not using a friendly skill on an enemy (unless it is DEFEND)
        if (inTrigger.target == SodaScriptTarget.ENEMY && potentialSkill.isFriendly && potentialSkill.id != SkillId.DEFEND)
        {
            return(false);
        }

        //make sure we're not using a damage skill on self or ally
        if ((inTrigger.target == SodaScriptTarget.ALLY || inTrigger.target == SodaScriptTarget.SELF) && !potentialSkill.isFriendly)
        {
            return(false);
        }

        //make sure if targeting self, chosen skill is allowed to self target
        if (inTrigger.target == SodaScriptTarget.SELF && !potentialSkill.allowsSelfTarget)
        {
            return(false);
        }

        //make sure not stealing from someone who has already been stolen from
        if ((potentialSkill.id == SkillId.PILFER || potentialSkill.id == SkillId.RANSACK) && potentialTargets[0].hasBeenStolenFrom)
        {
            return(false);
        }

        //don't try to transmute a target after we've already hit the limit of 1 successful transmute per battle (or if not a common enemy)
        if (potentialSkill.id == SkillId.TRANSMUTE)
        {
            bool battleIsBossOrMiniboss = (adventure.battleNumBasedOn10 == 5 || adventure.battleNumBasedOn10 == 10);
            if (adventure.battleManager.CurBattleTransmuteLimitReached() || battleIsBossOrMiniboss)
            {
                return(false);
            }
        }
        else if (potentialSkill.id == SkillId.FORETELL)
        {
            //don't try to foretell if the "force warp" flag is active for the current adventure
            if (adventure.forceWarpAtNextPaths)
            {
                return(false);
            }
        }

        //make sure an arena npc isn't using a banned skill
        if (activeCharacter.isArenaNpc && !potentialSkill.allowedForArenaNpcs)
        {
            return(false);
        }

        //make sure this team hasn't tried to heal itself too many times in a row
        if (potentialSkill.isHealing && ownTeam.HasReachedConsecutiveHealLimit())
        {
            return(false);
        }

        //if we found a valid target and skill, populate the commmand and return true
        inCommandToPopulate.Reset(potentialSkill, activeCharacter);
        inCommandToPopulate.AddTarget(potentialTargets[0]);
        return(true);
    }
コード例 #28
0
ファイル: Animal.cs プロジェクト: kauhiant/Unity_3DMaze
        public void Action()
        {
            switch (moveCommamd)
            {
            case MoveCommand.MoveUp:
                MoveFor(Vector2D.Up);
                break;

            case MoveCommand.MoveDown:
                MoveFor(Vector2D.Down);
                break;

            case MoveCommand.MoveLeft:
                MoveFor(Vector2D.Left);
                break;

            case MoveCommand.MoveRight:
                MoveFor(Vector2D.Right);
                break;

            case MoveCommand.TurnUp:
                TurnTo(Vector2D.Up);
                break;

            case MoveCommand.TurnDown:
                TurnTo(Vector2D.Down);
                break;

            case MoveCommand.TurnLeft:
                TurnTo(Vector2D.Left);
                break;

            case MoveCommand.TurnRight:
                TurnTo(Vector2D.Right);
                break;
            }

            switch (skillCommand)
            {
            case SkillCommand.ChangePlain:
                ChangePlain();
                break;

            case SkillCommand.Attack:
                Attack();
                break;

            case SkillCommand.Straight:
                Straight();
                break;

            case SkillCommand.Horizon:
                Horizon();
                break;

            case SkillCommand.Wall:
                Build();
                break;

            case SkillCommand.Together:
                Together();
                break;
            }

            moveCommamd  = MoveCommand.None;
            skillCommand = SkillCommand.None;
        }
コード例 #29
0
 // AI Simulation에서만 사용할 함수입니다.
 public static void ForceCreateCommand(Cube target, out SkillCommand skillCommand)
 {
     skillCommand = new SkillCommand(target);
 }
コード例 #30
0
    //技能使用
    public void ParseSkillCommand(BPSkill bp)
    {
        SkillCommand command = FightDefine.GetSkillCommand(bp.BattleId, bp.Frame, bp.SkillId, bp.SkillDir, bp.TargetPos, bp.TargetId);

        SceneEvent.GetInstance().dispatchEvent(SCENE_EVENT.ADD_COMMAND, new Notification(command));
    }