Example #1
0
        private string getClassAbilityData(SoldierClass soldier, SoldierRank rank)
        {
            List <SoldierClassAbility> rankSoldierAbilities = soldier.soldierAbilities.Where(x => x.rank == rank).OrderBy(x => x.slot).ToList();

            string abilityTree = "";

            foreach (SoldierClassAbility soldierAbility in rankSoldierAbilities)
            {
                if (!string.IsNullOrEmpty(soldierAbility.internalName))
                {
                    string thisAbility = "";
                    if (!string.IsNullOrEmpty(abilityTree))
                    {
                        thisAbility = ",";
                    }

                    //thisAbility += "(AbilityName=" + Utils.encaseStringInQuotes(soldierAbility.internalName) + ", ApplyToWeaponSlot=" + getIniWeaponSlot(soldierAbility.weaponSlot) + ")";

                    thisAbility += "(AbilityName=" + Utils.encaseStringInQuotes(soldierAbility.internalName);

                    if (soldierAbility.weaponSlot != WeaponSlot.None)
                    {
                        thisAbility += ", ApplyToWeaponSlot=" + getIniWeaponSlot(soldierAbility.weaponSlot);
                    }

                    thisAbility += ")";

                    abilityTree += thisAbility;
                }
            }

            abilityTree = "( aAbilityTree=(" + abilityTree + "),";

            return(abilityTree);
        }
Example #2
0
        private string getClassStatData(SoldierClass soldier, SoldierRank rank)
        {
            List <SoldierClassStat> rankStats = soldier.stats.Where(x => x.rank == rank).OrderBy(x => x.stat).ToList();

            string fullStat = "";

            foreach (SoldierClassStat squaddieStat in rankStats)
            {
                if (squaddieStat.value > 0)
                {
                    string thisStat = "";
                    if (!string.IsNullOrEmpty(fullStat))
                    {
                        thisStat = ",";
                    }

                    thisStat += "(StatType=" + getIniStat(squaddieStat.stat) + ",StatAmount=" + squaddieStat.value.ToString() + ")";
                    fullStat += thisStat;
                }
            }

            fullStat = "aStatProgression=(" + fullStat + "))";

            return(fullStat);
        }
Example #3
0
        private SoldierClassStat buildSoldierStatFromControl(TextBox control, SoldierRank rank, Stat stat)
        {
            SoldierClassStat soldierStat = new SoldierClassStat();

            soldierStat.rank  = rank;
            soldierStat.stat  = stat;
            soldierStat.value = Utils.parseStringToInt(control.Text);

            return(soldierStat);
        }
Example #4
0
        public string getStatValueText(SoldierRank rank, Stat stat)
        {
            int?statValue = getStatValue(rank, stat);

            if (statValue == null)
            {
                return("");
            }

            return(statValue.ToString());
        }
Example #5
0
        private Ability getAbilityForCombo(SoldierClass soldierClass, SoldierRank rank, int slot)
        {
            SoldierClassAbility soldierAbility = soldierClass.getSoldierAbility(rank, slot);

            if (soldierAbility != null)
            {
                return(soldierAbility.getAbility());
            }

            return(new Ability());
        }
Example #6
0
        public int?getStatValue(SoldierRank rank, Stat stat)
        {
            SoldierClassStat classStat = stats.Where(x => x.rank == rank && x.stat == stat).SingleOrDefault();

            if (classStat == null)
            {
                return(null);
            }

            return(classStat.value);
        }
Example #7
0
        private void writeClassRankData(SoldierClass soldier, SoldierRank rank)
        {
            string rankString = "+SoldierRanks=";

            rankString += getClassAbilityData(soldier, rank);
            rankString += getClassStatData(soldier, rank);

            lines.Add(";" + rank.ToString());
            lines.Add(rankString);
            lines.Add("");
        }
 public override void FillInformation(ISystem sys, out string info, out string detailed)
 {
     info = BaseUtils.FieldBuilder.Build("", Combat.ToString().SplitCapsWord(),
                                         "", Trade.ToString().SplitCapsWord(),
                                         "", Explore.ToString().SplitCapsWord(),
                                         "", SoldierRank.ToString().SplitCapsWord(),
                                         "", ExoBiologistRank.ToString().SplitCapsWord(),
                                         "", Federation.ToString().SplitCapsWord(),
                                         "", Empire.ToString().SplitCapsWord(),
                                         "", CQC.ToString().SplitCapsWord());
     detailed = "";
 }
Example #9
0
        private Ability getAbilityForCombo(SoldierRank rank, int slot)
        {
            ClassOverview owner = Owner as ClassOverview;

            SoldierClassAbility soldierAbility = owner.currentSoldier.soldierAbilities.Where(x => x.rank == rank && x.slot == slot).FirstOrDefault();

            if (soldierAbility != null)
            {
                return(soldierAbility.getAbility());
            }

            return(new Ability());
        }
Example #10
0
        private string getRankString(SoldierRank rank)
        {
            string soldierRankSquaddie = "( aAbilityTree=(";

            List <SoldierClassAbility> squaddieAbilities = currentSoldier.soldierAbilities.Where(x => x.rank == rank).OrderBy(x => x.slot).ToList();

            string fullAbility = "";

            foreach (SoldierClassAbility squaddieAbility in squaddieAbilities)
            {
                if (!string.IsNullOrEmpty(squaddieAbility.internalName))
                {
                    string thisAbility = "";
                    if (!string.IsNullOrEmpty(fullAbility))
                    {
                        thisAbility = ",";
                    }

                    thisAbility += "(AbilityName=" + Utils.encaseStringInQuotes(squaddieAbility.internalName) + ", ApplyToWeaponSlot=" + getIniWeaponSlot(squaddieAbility.weaponSlot) + ")";
                    fullAbility += thisAbility;
                }
            }

            List <SoldierClassStat> squaddieStats = currentSoldier.stats.Where(x => x.rank == SoldierRank.Squaddie).OrderBy(x => x.stat).ToList();

            string fullStat = "";

            foreach (SoldierClassStat squaddieStat in squaddieStats)
            {
                if (squaddieStat.value > 0)
                {
                    string thisStat = "";
                    if (!string.IsNullOrEmpty(fullStat))
                    {
                        thisStat = ",";
                    }

                    thisStat += "(StatType=" + squaddieStat.stat + ",StatAmount=" + squaddieStat.value.ToString() + ")";
                    fullStat += thisStat;
                }
            }

            fullStat = "aStatProgression=(" + fullStat + ")";


            soldierRankSquaddie += fullAbility + "), " + fullStat + ")";

            return(soldierRankSquaddie);
        }
Example #11
0
        private SoldierClassAbility buildSoldierAbilityFromCombo(ComboBox combo, SoldierRank rank, int slot)
        {
            SoldierClassAbility soldierAbility = new SoldierClassAbility();
            Ability             comboAbility   = combo.SelectedItem as Ability;

            if (comboAbility != null)
            {
                soldierAbility.internalName = comboAbility.internalName;
                soldierAbility.displayName  = comboAbility.displayName;
                soldierAbility.description  = comboAbility.description;
                soldierAbility.weaponSlot   = comboAbility.weaponSlot;
                soldierAbility.requiredMod  = comboAbility.requiredMod;
                soldierAbility.rank         = rank;
                soldierAbility.slot         = slot;
            }

            return(soldierAbility);
        }
Example #12
0
 public SoldierClassStat(SoldierClassStat other) : base()
 {
     stat  = other.stat;
     value = other.value;
     rank  = other.rank;
 }
Example #13
0
 private string getDisplayValueForStat(List <SoldierClassStat> soldierStats, SoldierRank rank, Stat stat)
 {
     return(soldierStats.Where(x => x.rank == rank && x.stat == stat).Select(x => x.value.ToString()).FirstOrDefault());
 }
Example #14
0
 public SoldierClassStat getStat(SoldierRank rank, Stat stat)
 {
     return(stats.Where(x => x.rank == rank && x.stat == stat).SingleOrDefault());
 }
Example #15
0
 private string getDescriptionFromList(SoldierRank rank, int slot)
 {
     return(currentSoldier.soldierAbilities.Where(x => x.rank == rank && x.slot == slot).Select(x => x.description).FirstOrDefault());
 }
Example #16
0
        public SoldierClassAbility getSoldierAbility(SoldierRank rank, int slot)
        {
            SoldierClassAbility soldierAbility = soldierAbilities.Where(x => x.rank == rank && x.slot == slot).FirstOrDefault();

            return(soldierAbility);
        }
Example #17
0
 public SoldierClassStat() : base()
 {
     stat  = Stat.HP;
     value = 0;
     rank  = SoldierRank.Squaddie;
 }
Example #18
0
 private void setCombo(ComboBox combo, SoldierRank rank, int slot)
 {
     combo.SelectedIndex = combo.Items.IndexOf(getAbilityForCombo(rank, slot));
 }
Example #19
0
 // TODO refactor
 private string getInternalNameFromList(List <SoldierClassAbility> soldierAbilities, SoldierRank rank, int slot)
 {
     return(soldierAbilities.Where(x => x.rank == rank && x.slot == slot).Select(x => x.displayName).FirstOrDefault());
 }