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); }
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); }
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); }
public string getStatValueText(SoldierRank rank, Stat stat) { int?statValue = getStatValue(rank, stat); if (statValue == null) { return(""); } return(statValue.ToString()); }
private Ability getAbilityForCombo(SoldierClass soldierClass, SoldierRank rank, int slot) { SoldierClassAbility soldierAbility = soldierClass.getSoldierAbility(rank, slot); if (soldierAbility != null) { return(soldierAbility.getAbility()); } return(new Ability()); }
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); }
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 = ""; }
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()); }
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); }
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); }
public SoldierClassStat(SoldierClassStat other) : base() { stat = other.stat; value = other.value; rank = other.rank; }
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()); }
public SoldierClassStat getStat(SoldierRank rank, Stat stat) { return(stats.Where(x => x.rank == rank && x.stat == stat).SingleOrDefault()); }
private string getDescriptionFromList(SoldierRank rank, int slot) { return(currentSoldier.soldierAbilities.Where(x => x.rank == rank && x.slot == slot).Select(x => x.description).FirstOrDefault()); }
public SoldierClassAbility getSoldierAbility(SoldierRank rank, int slot) { SoldierClassAbility soldierAbility = soldierAbilities.Where(x => x.rank == rank && x.slot == slot).FirstOrDefault(); return(soldierAbility); }
public SoldierClassStat() : base() { stat = Stat.HP; value = 0; rank = SoldierRank.Squaddie; }
private void setCombo(ComboBox combo, SoldierRank rank, int slot) { combo.SelectedIndex = combo.Items.IndexOf(getAbilityForCombo(rank, slot)); }
// 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()); }