private UnitStats() { _MaxHP = new SharableInt32(); _MaxEN = new SharableInt32(); _RegenEN = new SharableInt32(); _Armor = new SharableInt32(); _Mobility = new SharableInt32(); _MaxMovement = new SharableInt32(); ArrayUpgrade = new SharableInt32[5] { new SharableInt32(), new SharableInt32(), new SharableInt32(), new SharableInt32(), new SharableInt32() }; HPUpgrades = new SharableInt32(); ENUpgrades = new SharableInt32(); ArmorUpgrades = new SharableInt32(); MobilityUpgrades = new SharableInt32(); AttackUpgrades = new SharableInt32(); HPUpgrades.Value = 0; ENUpgrades.Value = 0; ArmorUpgrades.Value = 0; MobilityUpgrades.Value = 0; AttackUpgrades.Value = 0; DicUnitLink = new Dictionary <string, UnitLinkTypes>(); Boosts = new StatsBoosts(); Boosts.DicTerrainLetterAttributeModifier.Add(UnitStats.TerrainAir, 0); Boosts.DicTerrainLetterAttributeModifier.Add(UnitStats.TerrainLand, 0); Boosts.DicTerrainLetterAttributeModifier.Add(UnitStats.TerrainSea, 0); Boosts.DicTerrainLetterAttributeModifier.Add(UnitStats.TerrainSpace, 0); ArrayUnitAbility = new BaseAutomaticSkill[0]; ListAttack = new List <Attack>(); DicTerrainValue = new Dictionary <string, int>(); ListTerrainChoices = new List <string>(); ListCharacterIDWhitelist = new List <string>(); Animations = new UnitAnimations(); ListAttackTemporary = new List <Attack>(); }
public UnitStats(string Name, BinaryReader BR, Dictionary <string, BaseSkillRequirement> DicRequirement, Dictionary <string, BaseEffect> DicEffect) : this() { this.Name = Name; EXPValue = BR.ReadInt32(); _MaxHP.Value = BR.ReadInt32(); _MaxEN.Value = BR.ReadInt32(); _Armor.Value = BR.ReadInt32(); _Mobility.Value = BR.ReadInt32(); _MaxMovement.Value = (int)BR.ReadSingle(); AttackUpgradesSpeed = (AttackUpgradesSpeeds)BR.ReadByte(); AttackUpgradesCost = (AttackUpgradesCosts)BR.ReadByte(); int TerrainGradeCount = BR.ReadInt32(); DicTerrainValue = new Dictionary <string, int>(TerrainGradeCount); for (int G = 0; G < TerrainGradeCount; ++G) { DicTerrainValue.Add(BR.ReadString(), BR.ReadInt32()); } int TerrainChoicesCount = BR.ReadInt32(); ListTerrainChoices = new List <string>(TerrainChoicesCount); for (int i = 0; i < TerrainChoicesCount; i++) { ListTerrainChoices.Add(BR.ReadString()); } Size = BR.ReadString(); int SizeWidth = BR.ReadInt32(); int SizeHeight = BR.ReadInt32(); ArrayMapSize = new bool[SizeWidth, SizeHeight]; for (int X = 0; X < SizeWidth; X++) { for (int Y = 0; Y < SizeHeight; Y++) { ArrayMapSize[X, Y] = BR.ReadBoolean(); } } //Read Pilots whitelist. ListCharacterIDWhitelist = new List <string>(); Int32 ListPilotCount = BR.ReadInt32(); for (int P = 0; P < ListPilotCount; P++) { string CharacterName = BR.ReadString(); ListCharacterIDWhitelist.Add(CharacterName); } Int32 ListAttackCount = BR.ReadInt32(); ListAttack = new List <Attack>(ListAttackCount); for (int A = 0; A < ListAttackCount; ++A) { Attack NewAttack; bool IsExternal = BR.ReadBoolean(); string AttackName = BR.ReadString(); if (IsExternal) { NewAttack = new Attack(AttackName, DicRequirement, DicEffect); } else { NewAttack = new Attack(BR, AttackName, DicRequirement, DicEffect); } NewAttack.Ammo = NewAttack.MaxAmmo; if (NewAttack.Pri == WeaponPrimaryProperty.PLA) { PLAAttack = A; } //Load Animation paths. int AttackAnimationCount = BR.ReadInt32(); for (int An = 0; An < AttackAnimationCount; ++An) { NewAttack.Animations[An] = new AnimationInfo(BR.ReadString()); } ListAttack.Add(NewAttack); } Animations = new UnitAnimations(BR); Int32 ListAbilityCount = BR.ReadInt32(); ArrayUnitAbility = new BaseAutomaticSkill[ListAbilityCount]; for (int A = ListAbilityCount - 1; A >= 0; --A) { ArrayUnitAbility[A] = new BaseAutomaticSkill("Content/Units/Abilities/" + BR.ReadString() + ".pes", DicRequirement, DicEffect); } }