Esempio n. 1
0
 public string Description(Encounter enc, bool detailed)
 {
     string[] shortTimeString = new string[] { "Resumed (", this.fTimestamp.ToShortTimeString(), " ", this.fTimestamp.ToShortDateString(), ")" };
     return(string.Concat(shortTimeString));
 }
Esempio n. 2
0
        public bool DrawEncounter(Encounter enc)
        {
            if (this.fCards.Count == 0)
            {
                return(false);
            }
            List <EncounterCard> encounterCards  = new List <EncounterCard>();
            List <EncounterCard> encounterCards1 = new List <EncounterCard>();

            foreach (EncounterCard fCard in this.fCards)
            {
                if (fCard.Drawn)
                {
                    continue;
                }
                encounterCards1.Add(fCard);
            }
            int num = 0;

            while (true)
            {
                num++;
                bool flag = false;
                int  size = Session.Project.Party.Size;
                while (encounterCards.Count < size && encounterCards1.Count != 0)
                {
                    int           num1 = Session.Random.Next() % encounterCards1.Count;
                    EncounterCard item = encounterCards1[num1];
                    encounterCards.Add(item);
                    encounterCards1.Remove(item);
                    if (item.Category != CardCategory.Lurker || flag)
                    {
                        continue;
                    }
                    size++;
                    flag = true;
                }
                int num2 = 0;
                foreach (EncounterCard encounterCard in encounterCards)
                {
                    if (encounterCard.Category != CardCategory.SoldierBrute)
                    {
                        continue;
                    }
                    num2++;
                }
                if (num2 == 1 || num == 1000)
                {
                    break;
                }
                encounterCards1.AddRange(encounterCards);
                encounterCards.Clear();
            }
            foreach (EncounterCard encounterCard1 in encounterCards)
            {
                if (encounterCard1.Category != CardCategory.Solo)
                {
                    continue;
                }
                encounterCards.Remove(encounterCard1);
                encounterCards1.AddRange(encounterCards);
                encounterCards.Clear();
                encounterCards.Add(encounterCard1);
                break;
            }
            foreach (EncounterCard encounterCard2 in encounterCards)
            {
                encounterCard2.Drawn = true;
            }
            enc.Slots.Clear();
            foreach (EncounterCard encounterCard3 in encounterCards)
            {
                EncounterSlot encounterSlot = null;
                foreach (EncounterSlot slot in enc.Slots)
                {
                    if (slot.Card.CreatureID != encounterCard3.CreatureID)
                    {
                        continue;
                    }
                    encounterSlot = slot;
                    break;
                }
                if (encounterSlot == null)
                {
                    encounterSlot = new EncounterSlot()
                    {
                        Card = encounterCard3
                    };
                    enc.Slots.Add(encounterSlot);
                }
                int num3 = 1;
                switch (encounterCard3.Category)
                {
                case CardCategory.SoldierBrute:
                {
                    num3 = 2;
                    break;
                }

                case CardCategory.Minion:
                {
                    num3 += 4;
                    break;
                }
                }
                for (int i = 0; i != num3; i++)
                {
                    CombatData combatDatum = new CombatData();
                    encounterSlot.CombatData.Add(combatDatum);
                }
            }
            foreach (EncounterSlot slot1 in enc.Slots)
            {
                slot1.SetDefaultDisplayNames();
            }
            return(true);
        }
Esempio n. 3
0
        public string Description(Encounter enc, bool detailed)
        {
            string name = EncounterLog.GetName(this.fID, enc, detailed);

            return(string.Concat(name, " used <B>", this.fSkillName, "</B>"));
        }
Esempio n. 4
0
        public string GetDuration(Encounter enc)
        {
            string str = "";

            switch (this.fDuration)
            {
            case DurationType.Encounter:
            {
                return(str);
            }

            case DurationType.SaveEnds:
            {
                str = "save ends";
                if (this.SavingThrowModifier == 0)
                {
                    return(str);
                }
                string   str1 = (this.SavingThrowModifier >= 0 ? "+" : "");
                object   obj  = str;
                object[] savingThrowModifier = new object[] { obj, " with ", str1, this.SavingThrowModifier, " mod" };
                str = string.Concat(savingThrowModifier);
                return(str);
            }

            case DurationType.BeginningOfTurn:
            {
                string str2 = "";
                if (this.fDurationCreatureID != Guid.Empty)
                {
                    str2 = (enc == null ? "my" : string.Concat(enc.WhoIs(this.fDurationCreatureID), "'s"));
                }
                else
                {
                    str2 = "someone else's";
                }
                str = string.Concat(str, "until the start of ", str2, " next turn");
                return(str);
            }

            case DurationType.EndOfTurn:
            {
                string str3 = "";
                if (this.fDurationCreatureID != Guid.Empty)
                {
                    str3 = (enc == null ? "my" : string.Concat(enc.WhoIs(this.fDurationCreatureID), "'s"));
                }
                else
                {
                    str3 = "someone else's";
                }
                str = string.Concat(str, "until the end of ", str3, " next turn");
                return(str);
            }

            default:
            {
                return(str);
            }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Returns the duration of the effect as a string.
        /// </summary>
        /// <param name="enc">The encounter.</param>
        /// <returns></returns>
        public string GetDuration(Encounter enc)
        {
            string str = "";

            switch (fDuration)
            {
            case DurationType.Encounter:
                // Effectively, does not end
                break;

            case DurationType.SaveEnds:
            {
                str = "save ends";

                if (SavingThrowModifier != 0)
                {
                    string sign = (SavingThrowModifier >= 0) ? "+" : "";
                    str += " with " + sign + SavingThrowModifier + " mod";
                }
            }
            break;

            case DurationType.BeginningOfTurn:
            {
                string name = "";
                if (fDurationCreatureID == Guid.Empty)
                {
                    name = "someone else's";
                }
                else
                {
                    if (enc != null)
                    {
                        name = enc.WhoIs(fDurationCreatureID) + "'s";
                    }
                    else
                    {
                        name = "my";
                    }
                }

                str += "until the start of " + name + " next turn";
            }
            break;

            case DurationType.EndOfTurn:
            {
                string name = "";
                if (fDurationCreatureID == Guid.Empty)
                {
                    name = "someone else's";
                }
                else
                {
                    if (enc != null)
                    {
                        name = enc.WhoIs(fDurationCreatureID) + "'s";
                    }
                    else
                    {
                        name = "my";
                    }
                }

                str += "until the end of " + name + " next turn";
            }
            break;
            }

            return(str);
        }
Esempio n. 6
0
        public ReportTable CreateTable(ReportType report_type, BreakdownType breakdown_type, Encounter enc)
        {
            ReportTable reportTable = new ReportTable()
            {
                ReportType    = report_type,
                BreakdownType = breakdown_type
            };
            List <Pair <string, List <Guid> > > pairs = new List <Pair <string, List <Guid> > >();

            switch (breakdown_type)
            {
            case BreakdownType.Individual:
            {
                List <Guid> .Enumerator enumerator = this.Combatants.GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        Guid        current = enumerator.Current;
                        List <Guid> guids   = new List <Guid>()
                        {
                            current
                        };
                        pairs.Add(new Pair <string, List <Guid> >(enc.WhoIs(current), guids));
                    }
                    break;
                }
                finally
                {
                    ((IDisposable)enumerator).Dispose();
                }
            }

            case BreakdownType.Controller:
            {
                List <Guid> guids1 = new List <Guid>();
                foreach (Guid combatant in this.Combatants)
                {
                    if (Session.Project.FindHero(combatant) == null)
                    {
                        guids1.Add(combatant);
                    }
                    else
                    {
                        List <Guid> guids2 = new List <Guid>()
                        {
                            combatant
                        };
                        pairs.Add(new Pair <string, List <Guid> >(enc.WhoIs(combatant), guids2));
                    }
                }
                pairs.Add(new Pair <string, List <Guid> >("DM", guids1));
                break;
            }

            case BreakdownType.Faction:
            {
                List <Guid> guids3 = new List <Guid>();
                List <Guid> guids4 = new List <Guid>();
                List <Guid> guids5 = new List <Guid>();
                List <Guid> guids6 = new List <Guid>();
                foreach (Guid guid in this.Combatants)
                {
                    if (Session.Project.FindHero(guid) == null)
                    {
                        switch (enc.FindSlot(enc.FindCombatData(guid)).Type)
                        {
                        case EncounterSlotType.Opponent:
                        {
                            guids6.Add(guid);
                            continue;
                        }

                        case EncounterSlotType.Ally:
                        {
                            guids4.Add(guid);
                            continue;
                        }

                        case EncounterSlotType.Neutral:
                        {
                            guids5.Add(guid);
                            continue;
                        }

                        default:
                        {
                            continue;
                        }
                        }
                    }
                    else
                    {
                        guids3.Add(guid);
                    }
                }
                pairs.Add(new Pair <string, List <Guid> >("PCs", guids3));
                pairs.Add(new Pair <string, List <Guid> >("Allies", guids4));
                pairs.Add(new Pair <string, List <Guid> >("Neutral", guids5));
                pairs.Add(new Pair <string, List <Guid> >("Enemies", guids6));
                break;
            }
            }
            foreach (Pair <string, List <Guid> > pair in pairs)
            {
                if (pair.Second.Count == 0)
                {
                    continue;
                }
                ReportRow reportRow = new ReportRow()
                {
                    Heading = pair.First
                };
                if (pair.Second.Count == 1)
                {
                    reportRow.CombatantID = pair.Second[0];
                }
                for (int i = 1; i <= this.fRounds.Count; i++)
                {
                    switch (report_type)
                    {
                    case ReportType.Time:
                    {
                        int num = 0;
                        foreach (Guid second in pair.Second)
                        {
                            num += this.Time(second, i);
                        }
                        reportRow.Values.Add(num);
                        break;
                    }

                    case ReportType.DamageToEnemies:
                    {
                        int num1 = 0;
                        foreach (Guid second1 in pair.Second)
                        {
                            num1 += this.Damage(second1, i, false, enc);
                        }
                        reportRow.Values.Add(num1);
                        break;
                    }

                    case ReportType.DamageToAllies:
                    {
                        int num2 = 0;
                        foreach (Guid guid1 in pair.Second)
                        {
                            num2 += this.Damage(guid1, i, true, enc);
                        }
                        reportRow.Values.Add(num2);
                        break;
                    }

                    case ReportType.Movement:
                    {
                        int num3 = 0;
                        foreach (Guid second2 in pair.Second)
                        {
                            num3 += this.Movement(second2, i);
                        }
                        reportRow.Values.Add(num3);
                        break;
                    }
                    }
                }
                reportTable.Rows.Add(reportRow);
            }
            reportTable.Rows.Sort();
            switch (reportTable.ReportType)
            {
            case ReportType.Time:
            case ReportType.DamageToAllies:
            {
                reportTable.Rows.Reverse();
                return(reportTable);
            }

            case ReportType.DamageToEnemies:
            {
                return(reportTable);
            }

            default:
            {
                return(reportTable);
            }
            }
        }
Esempio n. 7
0
 public string Description(Encounter enc, bool detailed)
 {
     return(string.Concat("Round ", this.fRound));
 }
Esempio n. 8
0
        /// <summary>
        /// Draws cards from the deck to create an encounter.
        /// </summary>
        /// <param name="enc">The encounter to add to.</param>
        /// <returns>Returns true if the process succeeded; false otherwise.</returns>
        public bool DrawEncounter(Encounter enc)
        {
            if (fCards.Count == 0)
            {
                return(false);
            }

            List <EncounterCard> cards = new List <EncounterCard>();

            List <EncounterCard> available_cards = new List <EncounterCard>();

            foreach (EncounterCard card in fCards)
            {
                if (!card.Drawn)
                {
                    available_cards.Add(card);
                }
            }

            int attempts = 0;

            while (true)
            {
                attempts += 1;

                bool lurker = false;

                int hand_size = Session.Project.Party.Size;
                while ((cards.Count < hand_size) && (available_cards.Count != 0))
                {
                    int           index = Session.Random.Next() % available_cards.Count;
                    EncounterCard card  = available_cards[index];

                    cards.Add(card);
                    available_cards.Remove(card);

                    // If there's a lurker, draw an extra card
                    if ((card.Category == CardCategory.Lurker) && (!lurker))
                    {
                        hand_size += 1;
                        lurker     = true;
                    }
                }

                int soldier_cards = 0;
                foreach (EncounterCard card in cards)
                {
                    if (card.Category == CardCategory.SoldierBrute)
                    {
                        soldier_cards += 1;
                    }
                }

                if ((soldier_cards == 1) || (attempts == 1000))
                {
                    break;
                }

                available_cards.AddRange(cards);
                cards.Clear();
            }

            // If this hand contains the solo creature, take that card and return the others
            foreach (EncounterCard c in cards)
            {
                if (c.Category == CardCategory.Solo)
                {
                    cards.Remove(c);

                    available_cards.AddRange(cards);
                    cards.Clear();

                    cards.Add(c);

                    break;
                }
            }

            foreach (EncounterCard card in cards)
            {
                card.Drawn = true;
            }

            enc.Slots.Clear();

            foreach (EncounterCard card in cards)
            {
                // Do we already have a card of this type?
                EncounterSlot slot = null;
                foreach (EncounterSlot s in enc.Slots)
                {
                    if (s.Card.CreatureID == card.CreatureID)
                    {
                        slot = s;
                        break;
                    }
                }

                if (slot == null)
                {
                    slot      = new EncounterSlot();
                    slot.Card = card;
                    enc.Slots.Add(slot);
                }

                int count = 1;
                switch (card.Category)
                {
                case CardCategory.SoldierBrute:
                    count = 2;
                    break;

                case CardCategory.Minion:
                    count += 4;
                    break;
                }

                for (int n = 0; n != count; ++n)
                {
                    CombatData ccd = new CombatData();
                    slot.CombatData.Add(ccd);
                }
            }

            foreach (EncounterSlot slot in enc.Slots)
            {
                slot.SetDefaultDisplayNames();
            }

            return(true);
        }