Exemplo n.º 1
0
        public static DeathmatchMap CreateDummyMap(DeathmatchContext GlobalDeathmatchContext)
        {
            DeathmatchMap DummyMap = new DeathmatchMap(GlobalDeathmatchContext);

            DummyMap.LayerManager.ListLayer.Add(new MapLayer(DummyMap));
            DummyMap.LoadEffects();
            DummyMap.LoadSkillRequirements();
            DummyMap.LoadAutomaticSkillActivation();
            DummyMap.LoadDeathmatchAIScripts();

            DummyMap.NonDemoScreen  = new NonDemoScreen(DummyMap);
            DummyMap.ListGameScreen = new List <GameScreens.GameScreen>();

            DummyMap.LayerManager.ListLayer.Add(new MapLayer(DummyMap));
            DummyMap.LayerManager.ListLayer[0].ArrayTerrain = new Terrain[20, 20];
            for (int X = 0; X < 20; ++X)
            {
                for (int Y = 0; Y < 20; ++Y)
                {
                    DummyMap.LayerManager.ListLayer[0].ArrayTerrain[X, Y] = new Terrain(X, Y, 1, 0, 1, new TerrainActivation[0], new TerrainBonus[0], new int[0]);
                }
            }

            return(DummyMap);
        }
 public UnitCombining(DeathmatchMap Map)
     : base(Map)
 {
     OriginalUnitName       = string.Empty;
     CombinedUnitName       = string.Empty;
     ArrayCombiningUnitName = new string[0];
 }
Exemplo n.º 3
0
 public ActionPanelTransformPickUnit(DeathmatchMap Map, int ActivePlayerIndex, Squad ActiveSquad, bool ShowSquadMembers)
     : base(PanelName, Map)
 {
     this.ActivePlayerIndex = ActivePlayerIndex;
     this.ActiveSquad       = ActiveSquad;
     this.ShowSquadMembers  = ShowSquadMembers;
 }
        public static void ClassInit(TestContext context)
        {
            AutomaticSkillTargetType.DicTargetType.Clear();

            GlobalDeathmatchContext = new DeathmatchContext();
            DummyMap = DeathmatchMapHelper.CreateDummyMap(GlobalDeathmatchContext);
        }
 public ActionPanelTransform2Wingman(DeathmatchMap Map, int ActivePlayerIndex, int TransformingUnitIndex, Squad ActiveSquad, bool ShowSquadMembers)
     : base(PanelName, Map)
 {
     this.ActivePlayerIndex     = ActivePlayerIndex;
     this.TransformingUnitIndex = TransformingUnitIndex;
     this.ActiveSquad           = ActiveSquad;
     this.ShowSquadMembers      = ShowSquadMembers;
     TransformingUnit           = (UnitTransforming)ActiveSquad[TransformingUnitIndex];
 }
Exemplo n.º 6
0
        public UnitBuilder(string Name, ContentManager Content, DeathmatchMap Map, Dictionary <string, Unit> DicUnitType, Dictionary <string, BaseSkillRequirement> DicRequirement,
                           Dictionary <string, BaseEffect> DicEffect, Dictionary <string, AutomaticSkillTargetType> DicAutomaticSkillTarget)
            : base(Name)
        {
            this.Map      = Map;
            this.ItemName = Name;

            FileStream   FS = new FileStream("Content/Units/Builder/" + Name + ".peu", FileMode.Open, FileAccess.Read);
            BinaryReader BR = new BinaryReader(FS, Encoding.UTF8);

            BR.BaseStream.Seek(0, SeekOrigin.Begin);

            OriginalUnitName = BR.ReadString();
            if (!string.IsNullOrEmpty(OriginalUnitName) && DicUnitType != null)
            {
                OriginalUnit = Unit.FromFullName(OriginalUnitName, Content, DicUnitType, DicRequirement, DicEffect, DicAutomaticSkillTarget);
                _UnitStat    = OriginalUnit.UnitStat;
                _HP          = OriginalUnit.MaxHP;
                _EN          = OriginalUnit.MaxEN;
            }

            int UnitsToBuildCount = BR.ReadInt32();

            ListUnitToBuild = new List <String>(UnitsToBuildCount);
            for (int U = 0; U < UnitsToBuildCount; ++U)
            {
                ListUnitToBuild.Add(BR.ReadString());
            }

            if (Content != null)
            {
                string UnitDirectory = Path.GetDirectoryName("Content\\Units\\Normal\\" + Name);
                string XNADirectory  = UnitDirectory.Substring(8);

                if (File.Exists(UnitDirectory + "\\Map Sprite\\" + Name + ".xnb"))
                {
                    SpriteMap = Content.Load <Texture2D>(XNADirectory + "\\Map Sprite\\" + this.RelativePath);
                }
                else
                {
                    SpriteMap = Content.Load <Texture2D>("Units/Default");
                }

                if (File.Exists(UnitDirectory + "\\Unit Sprite\\" + Name + ".xnb"))
                {
                    SpriteUnit = Content.Load <Texture2D>(XNADirectory + "\\Unit Sprite\\" + this.RelativePath);
                }
                else
                {
                    SpriteUnit = Content.Load <Texture2D>("Units/Default");
                }
            }

            FS.Close();
            BR.Close();
        }
Exemplo n.º 7
0
 public SelectSkillTargetScreen(DeathmatchMap Map, ManualSkill ActiveSkill, Character SkillPilot, Unit SkillUnit, Squad SkillSquad, DeathmatchContext Context, ManualSkillTarget Owner)
 {
     this.Map         = Map;
     this.ActiveSkill = ActiveSkill;
     this.SkillPilot  = SkillPilot;
     this.SkillUnit   = SkillUnit;
     this.SkillSquad  = SkillSquad;
     this.Context     = Context;
     this.Owner       = Owner;
 }
            protected override void Execute(IOnlineConnection Host)
            {
                if (Map.TargetPlayerIndex != IncomingDefendingPlayerIndex)
                {
                    throw new Exception("Computing online defence pattern has failed");
                }

                DeathmatchMap.PrepareDefenseSquadForBattle(Map, Map.ActiveSquad, Map.TargetSquad);
                DeathmatchMap.PrepareAttackSquadForBattle(Map, Map.ActiveSquad, Map.TargetSquad);
            }
Exemplo n.º 9
0
        public override void ReinitializeMembers(Unit InitializedUnitBase)
        {
            UnitBuilder Other = (UnitBuilder)InitializedUnitBase;

            Map = Other.Map;

            if (OriginalUnit == null)
            {
                OriginalUnit = FromFullName(OriginalUnitName, Map.Content, Map.DicUnitType, Map.DicRequirement, Map.DicEffect);
                _UnitStat    = OriginalUnit.UnitStat;
                _HP          = OriginalUnit.MaxHP;
                _EN          = OriginalUnit.MaxEN;
            }
        }
Exemplo n.º 10
0
        public UnitTransforming(string Name, ContentManager Content, DeathmatchMap Map, Dictionary <string, BaseSkillRequirement> DicRequirement, Dictionary <string, BaseEffect> DicEffect,
                                Dictionary <string, AutomaticSkillTargetType> DicAutomaticSkillTarget)
            : base(Name, Map)
        {
            this.ItemName           = Name;
            PermanentTransformation = false;
            HPPercentage            = 1;
            ENPercentage            = 1;
            ActiveUnitIndex         = 0;
            TimeRemaining           = -1;
            ArrayOriginalCharacter  = new Character[0];

            FileStream   FS = new FileStream("Content/Units/Transforming/" + Name + ".peu", FileMode.Open, FileAccess.Read);
            BinaryReader BR = new BinaryReader(FS, Encoding.UTF8);

            BR.BaseStream.Seek(0, SeekOrigin.Begin);

            int ListTransformingUnitCount = BR.ReadInt32();

            ArrayTransformingUnit = new TransformationInformations[ListTransformingUnitCount];

            for (int U = 0; U < ListTransformingUnitCount; ++U)
            {
                ArrayTransformingUnit[U] = new TransformationInformations();

                string TransformingUnitPath = BR.ReadString();
                ArrayTransformingUnit[U].TransformingUnitName = TransformingUnitPath;

                ArrayTransformingUnit[U].UnitTransformed = new UnitNormal(TransformingUnitPath, Content, DicRequirement, DicEffect, DicAutomaticSkillTarget);

                ArrayTransformingUnit[U].WillRequirement         = BR.ReadInt32();
                ArrayTransformingUnit[U].TurnLimit               = BR.ReadInt32();
                ArrayTransformingUnit[U].PermanentTransformation = BR.ReadBoolean();
            }

            FS.Close();
            BR.Close();

            if (ArrayTransformingUnit.Length > 0)
            {
                _HP = ArrayTransformingUnit[0].UnitTransformed.MaxHP;
                _EN = ArrayTransformingUnit[0].UnitTransformed.MaxEN;
                ChangeUnit(ActiveUnitIndex);
            }
        }
Exemplo n.º 11
0
        public UnitCombining(string Name, ContentManager Content, DeathmatchMap Map, Dictionary <string, Unit> DicUnitType, Dictionary <string, BaseSkillRequirement> DicRequirement,
                             Dictionary <string, BaseEffect> DicEffect, Dictionary <string, AutomaticSkillTargetType> DicAutomaticSkillTarget)
            : base(Name, Map)
        {
            ItemName = Name;
            Combined = false;

            FileStream   FS = new FileStream("Content/Units/Combining/" + Name + ".peu", FileMode.Open, FileAccess.Read);
            BinaryReader BR = new BinaryReader(FS, Encoding.UTF8);

            BR.BaseStream.Seek(0, SeekOrigin.Begin);

            OriginalUnitName = BR.ReadString();
            if (!string.IsNullOrEmpty(OriginalUnitName) && DicUnitType != null)
            {
                OriginalUnit = FromFullName(OriginalUnitName, Content, DicUnitType, DicRequirement, DicEffect, DicAutomaticSkillTarget);

                _UnitStat = OriginalUnit.UnitStat;
                _HP       = OriginalUnit.MaxHP;
                _EN       = OriginalUnit.MaxEN;

                SpriteMap  = OriginalUnit.SpriteMap;
                SpriteUnit = OriginalUnit.SpriteUnit;
            }

            CombinedUnitName = BR.ReadString();
            if (!string.IsNullOrEmpty(CombinedUnitName) && DicUnitType != null)
            {
                CombinedUnit = FromFullName(CombinedUnitName, Content, DicUnitType, DicRequirement, DicEffect, DicAutomaticSkillTarget);
            }

            int ArrayCombiningUnitLength = BR.ReadInt32();

            ArrayCombiningUnitName = new string[ArrayCombiningUnitLength];

            for (int C = 0; C < ArrayCombiningUnitLength; ++C)
            {
                ArrayCombiningUnitName[C] = BR.ReadString();
            }

            FS.Close();
            BR.Close();
        }
Exemplo n.º 12
0
        public void TestSkillCreation()
        {
            BaseAutomaticSkill NewPilotSkill = new BaseAutomaticSkill();

            Character DummyCharacter = new Character();

            DummyCharacter.Level         = 1;
            DummyCharacter.ArrayLevelMEL = new int[1] {
                100
            };
            DummyCharacter.ArrayLevelRNG = new int[1] {
                100
            };
            DummyCharacter.ArrayLevelDEF = new int[1] {
                100
            };
            DummyCharacter.ArrayLevelSKL = new int[1] {
                100
            };
            DummyCharacter.ArrayLevelEVA = new int[1] {
                100
            };
            DummyCharacter.ArrayLevelHIT = new int[1] {
                100
            };
            DummyCharacter.Init();

            Unit   DummyUnit   = new UnitNormal();
            Attack DummyAttack = new Attack("Dummy Attack", string.Empty, 0, "10000", 0, 5, WeaponPrimaryProperty.None, WeaponSecondaryProperty.PostMovement, 10, 5, 0, 1, 100, "Laser", new System.Collections.Generic.Dictionary <string, char>());

            DummyUnit.ArrayCharacterActive = new Character[1] {
                DummyCharacter
            };
            DummyUnit.ListAttack.Add(DummyAttack);
            DummyUnit.AttackIndex = 0;
            Squad DummySquad = new Squad("Dummy", DummyUnit);

            Assert.AreEqual(190, DeathmatchMap.Accuracy(DummyUnit, 0));
        }
Exemplo n.º 13
0
 public SetAttackingSquadScript(DeathmatchMap Map, int ActivePlayerIndex, int ActiveSquadIndex)
     : base("Set Attacking Squad", Map)
 {
     this.ActivePlayerIndex = ActivePlayerIndex;
     this.ActiveSquadIndex  = ActiveSquadIndex;
 }
Exemplo n.º 14
0
 public UpdateWeaponMenuScript(DeathmatchMap Map)
     : base("Update Weapon menu", Map)
 {
 }
Exemplo n.º 15
0
 public SetAttackingSquadScript(DeathmatchMap Map)
     : this(Map, -1, -1)
 {
 }
Exemplo n.º 16
0
 public OpenWeaponMenuScript(DeathmatchMap Map)
     : base("Open Weapon menu", Map)
 {
 }
Exemplo n.º 17
0
 public SetDefendingSquadScript(DeathmatchMap Map)
     : this(Map, -1, -1)
 {
 }
Exemplo n.º 18
0
 public UpdateStatusMenuScript(DeathmatchMap Map)
     : base("Update Status Menu", Map)
 {
 }
Exemplo n.º 19
0
 public StartBattleScript(DeathmatchMap Map)
     : base("Start Battle", Map)
 {
 }
Exemplo n.º 20
0
 public PrepareToAttackScript(DeathmatchMap Map)
     : base("Prepare to Attack", Map)
 {
 }
Exemplo n.º 21
0
 public ComputeDefensePatternScript(DeathmatchMap Map)
     : base("Compute Defence Pattern", Map)
 {
 }
Exemplo n.º 22
0
 public GetReadyToMoveScript(DeathmatchMap Map)
     : base("Get Ready To Move", Map)
 {
 }
Exemplo n.º 23
0
 public UpdateBattleMenuScript(DeathmatchMap Map)
     : base("Update Battle menu", Map)
 {
 }
Exemplo n.º 24
0
 protected BattleMapScript(string Name, DeathmatchMap Map)
     : base(Name)
 {
     this.Map = Map;
 }
Exemplo n.º 25
0
 public OpenStatusMenuScript(DeathmatchMap Map)
     : base("Open Status Menu", Map)
 {
 }
Exemplo n.º 26
0
 public MoveUnitScript(DeathmatchMap Map)
     : base("Move Unit", Map)
 {
 }
Exemplo n.º 27
0
 public SpawnSquadScript(DeathmatchMap Map)
     : base("Spawn Squad", Map)
 {
 }
Exemplo n.º 28
0
 public UpdateUnitStatusScript(DeathmatchMap Map)
     : this(null, -1, -1)
 {
 }
Exemplo n.º 29
0
 public SetDefendingSquadScript(DeathmatchMap Map, int ActivePlayerIndex, int TargetSquadIndex)
     : base("Set Defending Squad", Map)
 {
     this.ActivePlayerIndex = ActivePlayerIndex;
     this.TargetSquadIndex  = TargetSquadIndex;
 }
Exemplo n.º 30
0
 public UpdateUnitStatusScript(DeathmatchMap Map, int UpdatedPlayerIndex, int UpdatedSquadIndex)
     : base("Update Unit status", Map)
 {
     IsFlying = Map.ListPlayer[UpdatedPlayerIndex].ListSquad[UpdatedSquadIndex].IsFlying;
 }