コード例 #1
0
ファイル: PlayerMove.cs プロジェクト: parrexion/Fried-Embrum
    /// <summary>
    /// Checks if the character can talk to anyone.
    /// </summary>
    /// <returns></returns>
    public bool CanTalk()
    {
        List <MapTile> talkers = FindAdjacentCharacters(false, true, true);

        for (int i = 0; i < talkers.Count; i++)
        {
            for (int talk = 0; talk < talkers[i].currentCharacter.talkQuotes.Count; talk++)
            {
                FightQuote fq = talkers[i].currentCharacter.talkQuotes[talk];
                if (!fq.activated && (fq.triggerer == null || fq.triggerer.uuid == stats.charData.uuid))
                {
                    return(true);
                }
            }
        }
        return(false);
    }
コード例 #2
0
    private void FindTalkers()
    {
        targetList.values.Clear();
        PlayerMove     player  = (PlayerMove)selectedCharacter.value;
        List <MapTile> talkers = player.FindAdjacentCharacters(false, true, true);

        for (int i = 0; i < talkers.Count; i++)
        {
            for (int talk = 0; talk < talkers[i].currentCharacter.talkQuotes.Count; talk++)
            {
                FightQuote fq = talkers[i].currentCharacter.talkQuotes[talk];
                if (!fq.activated && (fq.triggerer == null || fq.triggerer.uuid == player.stats.charData.uuid))
                {
                    targetList.values.Add(talkers[i]);
                    break;
                }
            }
        }
    }
コード例 #3
0
    public void TalkToCharacter(MapTile targetTile)
    {
        PlayerMove  player = (PlayerMove)selectedCharacter.value;
        TacticsMove other  = targetTile.currentCharacter;

        currentActionMode.value = ActionMode.NONE;
        dialogueMode.value      = (int)DialogueMode.TALK;

        FightQuote quote = null;

        for (int i = 0; i < other.talkQuotes.Count; i++)
        {
            FightQuote fq = other.talkQuotes[i];
            if (!fq.activated && (fq.triggerer == null || fq.triggerer.uuid == player.stats.charData.uuid))
            {
                quote = fq;
                break;
            }
        }

        dialogueEntry.value   = quote.quote;
        willJoin              = quote.willJoin;
        villageVisitor1.value = player.stats.charData.portraitSet;
        startDialogue.Invoke();

        if (willJoin)
        {
            SpawnData joinData = new SpawnData(other)
            {
                joiningSquad = player.squad
            };
            joiningCharacter             = mapSpawner.SpawnPlayerCharacter(joinData, false, false, false);
            joiningCharacter.currentTile = targetTile;
            other.RemoveFromList();
            Destroy(other.gameObject);
        }
    }
コード例 #4
0
    public void GenerateDamageActions()
    {
        TacticsMove attacker = attackerTile.value.currentCharacter;
        TacticsMove defender = defenderTile.value.currentCharacter;

        dialogue = null;
        if (defender == null)
        {
            showBattleAnim    = false;
            _currentCharacter = attacker;
            actions.Clear();
            actions.Add(new BattleAction(AttackSide.LEFT, BattleAction.Type.DAMAGE, attacker, defenderTile.value.blockMove));
            Debug.Log("BLOCK FIGHT!!");
        }
        else
        {
            showBattleAnim = useBattleAnimations.value;
            // Add battle init boosts
            attacker.ActivateSkills(SkillActivation.INITCOMBAT, defender);
            attacker.ActivateSkills(SkillActivation.PRECOMBAT, defender);
            defender.ActivateSkills(SkillActivation.COUNTER, attacker);
            defender.ActivateSkills(SkillActivation.PRECOMBAT, attacker);

            _currentCharacter = attacker;
            InventoryTuple atkTup = attacker.GetEquippedWeapon(ItemCategory.WEAPON);
            InventoryTuple defTup = defender.GetEquippedWeapon(ItemCategory.WEAPON);
            actions.Clear();
            actions.Add(new BattleAction(AttackSide.LEFT, BattleAction.Type.DAMAGE, attacker, defender));
            int range = Mathf.Abs(attacker.posx - defender.posx) + Mathf.Abs(attacker.posy - defender.posy);
            if (!string.IsNullOrEmpty(defTup.uuid) && defTup.currentCharges > 0 && defender.GetEquippedWeapon(ItemCategory.WEAPON).InRange(range))
            {
                actions.Add(new BattleAction(AttackSide.RIGHT, BattleAction.Type.DAMAGE, defender, attacker));
            }
            //Compare speeds
            int spdDiff = actions[0].GetSpeedDifference();
            if (spdDiff >= doublingSpeed.value)
            {
                if (atkTup.currentCharges > 1)
                {
                    actions.Add(new BattleAction(AttackSide.LEFT, BattleAction.Type.DAMAGE, attacker, defender));
                }
            }
            else if (spdDiff <= -doublingSpeed.value)
            {
                if (!string.IsNullOrEmpty(defTup.uuid) && defTup.currentCharges > 0 && defender.GetEquippedWeapon(ItemCategory.WEAPON).InRange(range))
                {
                    actions.Add(new BattleAction(AttackSide.RIGHT, BattleAction.Type.DAMAGE, defender, attacker));
                }
            }

            TacticsMove quoter    = (attacker.faction == Faction.ENEMY) ? attacker : defender;
            CharEntry   triggerer = (attacker.faction == Faction.ENEMY) ? defender.stats.charData : attacker.stats.charData;
            FightQuote  bestFind  = null;
            for (int q = 0; q < quoter.fightQuotes.Count; q++)
            {
                if (quoter.fightQuotes[q].triggerer == null)
                {
                    if (bestFind == null)
                    {
                        bestFind = quoter.fightQuotes[q];
                    }
                }
                else if (quoter.fightQuotes[q].triggerer == triggerer)
                {
                    bestFind = quoter.fightQuotes[q];
                    break;
                }
            }
            if (bestFind != null && !bestFind.activated)
            {
                dialogue           = bestFind.quote;
                bestFind.activated = true;
            }
        }
    }