コード例 #1
0
    internal void CooperateEvent2()
    {
        List <KingdomTileTest> kingdoms = new List <KingdomTileTest> ();

        kingdoms.AddRange(this.kingdoms);


        if (kingdoms.Count > 1)
        {
            kingdoms = Utilities.Shuffle(kingdoms);

            /*
             * A huge monster guarding some treasure is discovered.
             * The Lords must cooperate to defeat it. If they cooperate, the monster is defeated and they are able to split the treasure.
             * One can be betrayed by unleashing the monster onto the other Lord's realm while the other takes all the treasure.
             * If both attempt to do this, the monster stays and the treasure remains guarded.
             */

            int  randomLord1 = UnityEngine.Random.Range(0, kingdoms.Count);
            Lord lord1       = kingdoms [randomLord1].kingdom.lord;
            kingdoms.RemoveAt(randomLord1);

            int  randomLord2 = UnityEngine.Random.Range(0, kingdoms.Count);
            Lord lord2       = kingdoms [randomLord2].kingdom.lord;
            kingdoms.RemoveAt(randomLord2);

            DECISION lord1Decision = lord1.ComputeDecisionBasedOnPersonality(LORD_EVENTS.COOPERATE2, lord2);
            DECISION lord2Decision = lord2.ComputeDecisionBasedOnPersonality(LORD_EVENTS.COOPERATE2, lord1);

            if (lord1Decision == DECISION.NICE && lord2Decision == DECISION.NICE)
            {
            }
            else if (lord1Decision == DECISION.NICE && lord2Decision == DECISION.RUDE)
            {
            }
            else if (lord1Decision == DECISION.RUDE && lord2Decision == DECISION.NICE)
            {
            }
            else if (lord1Decision == DECISION.RUDE && lord2Decision == DECISION.RUDE)
            {
            }

            UserInterfaceManager.Instance.externalAffairsLogList[UserInterfaceManager.Instance.externalAffairsLogList.Count - 1] += this.currentDay.ToString() + ": COOPERATE EVENT 2: " + lord1.name + " decided to be " + lord1Decision.ToString()
                                                                                                                                    + ". " + lord2.name + " decided to be " + lord2Decision.ToString() + ".\n\n";

            pendingCooperateEvents.Add(new CooperateEvents(lord1.id, lord1Decision, lord2.id, lord2Decision, LORD_EVENTS.COOPERATE2, (currentDay + 5)));

            Utilities.cooperate2Count++;
        }
        else
        {
            Debug.Log("THERE IS NOT ENOUGH KINGDOMS! CAN'T COOPERATE (2)");
        }
    }