Ejemplo n.º 1
0
        public static Entity CreatePlayerEntity(int currentTick)
        {
            var e = CreateEntity(Guid.NewGuid().ToString(), "You");

            // TODO: modify PlayerAIComponent to it doesn't, you know...need these.
            e.AddComponent(new PlayerAIComponent());
            e.AddComponent(AIRotationComponent.Create(.60, true));
            e.AddComponent(AIMoraleComponent.Create(100, 100));

            var statusEffectTrackerComponent = StatusEffectTrackerComponent.Create();

            e.AddComponent(ActionTimeComponent.Create(currentTick));
            e.AddComponent(AttackerComponent.Create(e.EntityId, power: 8, meleeAttack: 55, rangedAttack: 10)); // TODO: make player not Ares
            e.AddComponent(CollisionComponent.Create(blocksMovement: true, blocksVision: false));
            e.AddComponent(DefenderComponent.Create(baseDefense: 0, maxHp: 70, maxFooting: 95, meleeDefense: 30, rangedDefense: 60, isInvincible: false));
            e.AddComponent(DisplayComponent.Create(_texPlayerPath, "It's you!", false, ENTITY_Z_INDEX));
            e.AddComponent(FactionComponent.Create(FactionName.PLAYER));
            e.AddComponent(OnDeathComponent.Create(new List <string>()
            {
                OnDeathEffectType.PLAYER_DEFEAT
            }));
            e.AddComponent(PlayerComponent.Create(isInFormation: true));
            e.AddComponent(SpeedComponent.Create(baseSpeed: 100));
            e.AddComponent(statusEffectTrackerComponent);
            e.AddComponent(XPTrackerComponent.Create(levelUpBase: 200, levelUpFactor: 150));

            return(e);
        }
Ejemplo n.º 2
0
        public static Entity CreatePunicHeavyInfantry(int currentTick, int formationNumber, Unit unit, FactionName faction)
        {
            var e = CreateEntity(Guid.NewGuid().ToString(), "Punic Heavy Infantry");

            var statusEffectTrackerComponent = StatusEffectTrackerComponent.Create();

            // TODO: one day I'll have different AIs
            e.AddComponent(new IberianLightInfantryAIComponent());
            e.AddComponent(AIRotationComponent.Create(.4, false));
            e.AddComponent(AIMoraleComponent.Create(100, 90));

            e.AddComponent(ActionTimeComponent.Create(currentTick));
            e.AddComponent(AttackerComponent.Create(e.EntityId, 11, meleeAttack: 55, rangedAttack: 10));
            e.AddComponent(CollisionComponent.CreateDefaultActor());
            e.AddComponent(DefenderComponent.Create(baseDefense: 4, maxHp: 80, maxFooting: 140, meleeDefense: 40, rangedDefense: 45));
            e.AddComponent(DisplayComponent.Create(_texPunicHeavyInfantryPath, "Carthage's very best heavy infantry.", false, ENTITY_Z_INDEX));
            e.AddComponent(FactionComponent.Create(faction));
            e.AddComponent(OnDeathComponent.Create(new List <string>()
            {
                OnDeathEffectType.REMOVE_FROM_UNIT
            }));
            e.AddComponent(SpeedComponent.Create(baseSpeed: 100));
            e.AddComponent(statusEffectTrackerComponent);
            e.AddComponent(UnitComponent.Create(unit.UnitId, formationNumber));
            e.AddComponent(XPValueComponent.Create(xpValue: 30));

            return(e);
        }
Ejemplo n.º 3
0
        public static Entity CreateHastatusEntity(int currentTick, int formationNumber, Unit unit, FactionName faction,
                                                  int numPilas = 1, int startingMorale = 45)
        {
            var e = CreateEntity(Guid.NewGuid().ToString(), "Hastatus");

            var statusEffectTrackerComponent = StatusEffectTrackerComponent.Create();

            e.AddComponent(new HastatusAIComponent(numPilas));
            e.AddComponent(AIRotationComponent.Create(.60, false));
            e.AddComponent(AIMoraleComponent.Create(100, startingMorale));

            e.AddComponent(ActionTimeComponent.Create(currentTick));
            e.AddComponent(AttackerComponent.Create(e.EntityId, 5, meleeAttack: 50, rangedAttack: 30));
            e.AddComponent(CollisionComponent.CreateDefaultActor());
            e.AddComponent(DefenderComponent.Create(baseDefense: 2, maxHp: 45, maxFooting: 80, meleeDefense: 10, rangedDefense: 25));
            e.AddComponent(DisplayComponent.Create(_texHastatusPath, "A young and eager soldier.", false, ENTITY_Z_INDEX));
            e.AddComponent(FactionComponent.Create(faction));
            e.AddComponent(OnDeathComponent.Create(new List <string>()
            {
                OnDeathEffectType.REMOVE_FROM_UNIT
            }));
            e.AddComponent(SpeedComponent.Create(baseSpeed: 100));
            e.AddComponent(statusEffectTrackerComponent);
            e.AddComponent(UnitComponent.Create(unit.UnitId, formationNumber));
            e.AddComponent(XPValueComponent.Create(xpValue: 30));

            return(e);
        }
Ejemplo n.º 4
0
        public ThrowingWeapon(Vector2f position, Vector2f direction, int damage, float attackSpeed)
        {
            displayComponent          = new DisplayComponent(Config.HeroWeaponName);
            displayComponent.Position = position;

            moveComponent = new MoveComponent(displayComponent, Config.WeaponSpeed);
            moveComponent.GetNextPosition_Event += MoveComponent_GetNextPosition;
            moveComponent.CheckMove_Event       += MoveComponent_CheckMove_Event;

            healthComponent       = new HealthComponent(Config.WeaponHealth);
            healthComponent.Died += HealthComponent_Died;

            damageComponent           = new DamageComponent(damage, attackSpeed);
            damageComponent.Attacked += DamageComponent_Attacked;

            collisionComponent = new CollisionComponent(displayComponent, damageComponent, Config.WeaponCollisionRect, "player");
            collisionComponent.OnCollisiton += CollisionComponent_OnCollisiton;

            this.direction = direction;

            Vector2f origin = displayComponent.Origin;

            origin.X = displayComponent.Size.X / 2;
            origin.Y = displayComponent.Size.Y / 2;
            displayComponent.Origin = origin;
        }
Ejemplo n.º 5
0
        public static Entity CreatePrincepsEntity(int currentTick, int formationNumber, Unit unit, FactionName faction,
                                                  int numPilas = 1, int startingMorale = 65)
        {
            var e = CreateEntity(Guid.NewGuid().ToString(), "Princeps");

            var statusEffectTrackerComponent = StatusEffectTrackerComponent.Create();

            // Princeps AI is essentially the same as Hastatus AI
            e.AddComponent(new HastatusAIComponent(numPilas));
            e.AddComponent(AIRotationComponent.Create(.60, false));
            e.AddComponent(AIMoraleComponent.Create(100, startingMorale));

            e.AddComponent(ActionTimeComponent.Create(currentTick));
            e.AddComponent(AttackerComponent.Create(e.EntityId, 6, meleeAttack: 55, rangedAttack: 30));
            e.AddComponent(CollisionComponent.CreateDefaultActor());
            e.AddComponent(DefenderComponent.Create(baseDefense: 2, maxHp: 65, maxFooting: 100, meleeDefense: 15, rangedDefense: 30));
            e.AddComponent(DisplayComponent.Create(_texPrincepsPath, "An experienced swordsman with good equipment.", false, ENTITY_Z_INDEX));
            e.AddComponent(FactionComponent.Create(faction));
            e.AddComponent(OnDeathComponent.Create(new List <string>()
            {
                OnDeathEffectType.REMOVE_FROM_UNIT
            }));
            e.AddComponent(SpeedComponent.Create(baseSpeed: 100));
            e.AddComponent(statusEffectTrackerComponent);
            e.AddComponent(UnitComponent.Create(unit.UnitId, formationNumber));
            e.AddComponent(XPValueComponent.Create(xpValue: 30));

            return(e);
        }
Ejemplo n.º 6
0
        public static Entity Create(string saveData)
        {
            var loaded = JsonSerializer.Deserialize <SaveData>(saveData);

            var entity = new Entity().Init(entityId: loaded.EntityId, entityName: loaded.EntityName);

            foreach (var component in loaded.Components)
            {
                entity.AddComponent(component);
            }

            // TODO: Formalize this into a "template" concept
            if (entity.EntityName == "boundary sign")
            {
                entity.AddComponent(CollisionComponent.Create(true, false));
                entity.AddComponent(DefenderComponent.Create(0, 100, logDamage: false, isInvincible: true));
                entity.AddComponent(DisplayComponent.Create("res://resources/sprites/edge_blocker.png", "Trying to run away, eh? Get back to your mission!", true, 2));
            }
            else if (entity.EntityName == "satellite")
            {
                entity.AddComponent(CollisionComponent.Create(blocksMovement: true, blocksVision: true));
                entity.AddComponent(DefenderComponent.Create(baseDefense: int.MaxValue, maxHp: int.MaxValue, isInvincible: true, logDamage: false));
                entity.AddComponent(DisplayComponent.Create("res://resources/sprites/asteroid.png", "Space junk. Blocks movement and projectiles. Cannot be destroyed.", true, 2));
            }

            return(entity);
        }
Ejemplo n.º 7
0
    private void ListDisplayProperties(DisplayProperties dp)
    {
        Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("List Display Properties: \nName:" + dp.Name + "\n");


        System.Collections.Specialized.StringCollection sc = new System.Collections.Specialized.StringCollection();

        DisplayComponent[] components = dp.GetDisplayComponents(out sc);
        if (components == null || components.Length == 0)
        {
            return;
        }
        //foreach (DisplayComponent obj in components)
        for (int i = 0; i < components.Length; i++)
        {
            DisplayComponent obj  = components[i];
            string           name = sc[i];
            DisplayComponent dc   = (DisplayComponent)obj;
            Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("List Display Components: " + name + "\n");
            Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("Is Applicable? : " + dc.IsApplicable.ToString() + "\n");
            Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("Is Inherited?: " + dc.IsInherited.ToString() + "\n");

            if (dc is DisplayComponentEntity)
            {
                Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("It is a Display Component Entity. \n");
            }
            if (dc is DisplayComponentHatch)
            {
                Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("It is a Display Component Hatch. \n");
            }
        }
    }
Ejemplo n.º 8
0
        private static void DrawEntities(List <Guid> drawableEntities, StateSpaceComponents spaceComponents, DungeonTile[,] dungeonGrid, Matrix cameraMatrix, bool inWater, bool inFire, SpriteBatch spriteBatch, Texture2D spriteSheet, SpriteFont font, Camera camera, DungeonColorInfo colorInfo)
        {
            foreach (Guid id in drawableEntities)
            {
                DisplayComponent display  = spaceComponents.DisplayComponents[id];
                Vector2          gridPos  = spaceComponents.PositionComponents[id].Position;
                Vector2          position = new Vector2(spaceComponents.PositionComponents[id].Position.X * DevConstants.Grid.CellSize, spaceComponents.PositionComponents[id].Position.Y * DevConstants.Grid.CellSize);
                if (dungeonGrid[(int)spaceComponents.PositionComponents[id].Position.X, (int)spaceComponents.PositionComponents[id].Position.Y].InRange || display.AlwaysDraw)
                {
                    Vector2   bottomRight  = Vector2.Transform(new Vector2((position.X) + DevConstants.Grid.CellSize, (position.Y) + DevConstants.Grid.CellSize), cameraMatrix);
                    Vector2   topLeft      = Vector2.Transform(new Vector2(position.X, position.Y), cameraMatrix);
                    Rectangle cameraBounds = new Rectangle((int)topLeft.X, (int)topLeft.Y, (int)bottomRight.X - (int)topLeft.X, (int)bottomRight.Y - (int)topLeft.Y);

                    if (camera.IsInView(cameraMatrix, cameraBounds))
                    {
                        //If the item is in water, you need to tint it, and if the player is in water and the object isn't (or vice versa) it must be hidden unless it's the observer.
                        display = dungeonGrid[(int)gridPos.X, (int)gridPos.Y].Type == TileType.TILE_WATER == inWater || (spaceComponents.Entities.Where(x => (x.Id == id)).First().ComponentFlags & ComponentMasks.Observer) == ComponentMasks.Observer ? display : DevConstants.ConstantComponents.UnknownDisplay;
                        Color displayColor = dungeonGrid[(int)gridPos.X, (int)gridPos.Y].Type == TileType.TILE_WATER || inWater?Color.Lerp(display.Color, colorInfo.WaterInRange, .5f) : display.Color;

                        if (!inWater && dungeonGrid[(int)gridPos.X, (int)gridPos.Y].Type != TileType.TILE_WATER)
                        {
                            displayColor = dungeonGrid[(int)gridPos.X, (int)gridPos.Y].FireIllumination || inFire?Color.Lerp(display.Color, colorInfo.FireInRange, .5f) : display.Color;
                        }

                        spriteBatch.Draw(spriteSheet, position, display.SpriteSource, displayColor * display.Opacity, display.Rotation, display.Origin, display.Scale, display.SpriteEffect, 0f);
                        if (!string.IsNullOrEmpty(display.Symbol))
                        {
                            Vector2 size = font.MeasureString(display.Symbol);
                            spriteBatch.DrawString(font, display.Symbol, new Vector2(((int)position.X + (int)display.SpriteSource.Center.X), ((int)position.Y + (int)display.SpriteSource.Center.Y)),
                                                   display.SymbolColor, 0f, new Vector2((int)(size.X / 2), (int)(size.Y / 2) - 3), 1f, SpriteEffects.None, 0f);
                        }
                    }
                }
            }
        }
Ejemplo n.º 9
0
        public void IncludesEntityGroup()
        {
            var         component    = DisplayComponent.Create("", "", true, 0);
            JsonElement deserialized = JsonSerializer.Deserialize <JsonElement>(component.Save());

            Assert.Equal(DisplayComponent.ENTITY_GROUP, deserialized.GetProperty("EntityGroup").GetString());
        }
Ejemplo n.º 10
0
        public static Entity CreateIberianLightInfantry(int currentTick, int formationNumber, Unit unit, FactionName faction)
        {
            var e = CreateEntity(Guid.NewGuid().ToString(), "Iberian Light Infantry");

            var statusEffectTrackerComponent = StatusEffectTrackerComponent.Create();

            e.AddComponent(new IberianLightInfantryAIComponent());
            e.AddComponent(AIRotationComponent.Create(.7, false));
            e.AddComponent(AIMoraleComponent.Create(100, 90));

            e.AddComponent(ActionTimeComponent.Create(currentTick));
            e.AddComponent(AttackerComponent.Create(e.EntityId, 5, meleeAttack: 55, rangedAttack: 10));
            e.AddComponent(CollisionComponent.CreateDefaultActor());
            e.AddComponent(DefenderComponent.Create(baseDefense: 1, maxHp: 40, maxFooting: 75, meleeDefense: 15, rangedDefense: 5));
            e.AddComponent(DisplayComponent.Create(_texIberianLightInfantryPath, "A fast, deatly, and barely armored Iberian swordsman.", false, ENTITY_Z_INDEX));
            e.AddComponent(FactionComponent.Create(faction));
            e.AddComponent(OnDeathComponent.Create(new List <string>()
            {
                OnDeathEffectType.REMOVE_FROM_UNIT
            }));
            e.AddComponent(SpeedComponent.Create(baseSpeed: 80));
            e.AddComponent(statusEffectTrackerComponent);
            e.AddComponent(UnitComponent.Create(unit.UnitId, formationNumber));
            e.AddComponent(XPValueComponent.Create(xpValue: 30));

            return(e);
        }
Ejemplo n.º 11
0
        public static Entity CreateTriariusEntity(int currentTick, int formationNumber, Unit unit, FactionName faction,
                                                  int startingMorale = 85)
        {
            var e = CreateEntity(Guid.NewGuid().ToString(), "Triarius");

            var statusEffectTrackerComponent = StatusEffectTrackerComponent.Create();

            // TODO: different AI
            e.AddComponent(new HastatusAIComponent(0));
            e.AddComponent(AIRotationComponent.Create(.60, false));
            e.AddComponent(AIMoraleComponent.Create(100, startingMorale));

            e.AddComponent(ActionTimeComponent.Create(currentTick));
            e.AddComponent(AttackerComponent.Create(e.EntityId, 8, meleeAttack: 70, rangedAttack: 30));
            e.AddComponent(CollisionComponent.CreateDefaultActor());
            e.AddComponent(DefenderComponent.Create(baseDefense: 3, maxHp: 85, maxFooting: 120, meleeDefense: 30, rangedDefense: 45));
            e.AddComponent(DisplayComponent.Create(_texTriariusPath, "An elite spearman of the legion.", false, ENTITY_Z_INDEX));
            e.AddComponent(FactionComponent.Create(faction));
            e.AddComponent(OnDeathComponent.Create(new List <string>()
            {
                OnDeathEffectType.REMOVE_FROM_UNIT
            }));
            e.AddComponent(SpeedComponent.Create(baseSpeed: 100));
            e.AddComponent(statusEffectTrackerComponent);
            e.AddComponent(UnitComponent.Create(unit.UnitId, formationNumber));
            e.AddComponent(XPValueComponent.Create(xpValue: 30));

            return(e);
        }
Ejemplo n.º 12
0
        public static Entity CreateGallicVeteranInfantry(int currentTick, int formationNumber, Unit unit, FactionName faction)
        {
            var e = CreateEntity(Guid.NewGuid().ToString(), "Gallic Veteran Infantry");

            var statusEffectTrackerComponent = StatusEffectTrackerComponent.Create();

            // TODO: one day I'll have different AIs
            e.AddComponent(new IberianLightInfantryAIComponent());
            e.AddComponent(AIRotationComponent.Create(.4, false));
            e.AddComponent(AIMoraleComponent.Create(100, 90));

            e.AddComponent(ActionTimeComponent.Create(currentTick));
            e.AddComponent(AttackerComponent.Create(e.EntityId, 9, meleeAttack: 50, rangedAttack: 10));
            e.AddComponent(CollisionComponent.CreateDefaultActor());
            e.AddComponent(DefenderComponent.Create(baseDefense: 2, maxHp: 55, maxFooting: 110, meleeDefense: 30, rangedDefense: 45));
            e.AddComponent(DisplayComponent.Create(_texGallicVeteranInfantryPath, "An armored Gallic veteran. Fights defensively, but hits hard.", false, ENTITY_Z_INDEX));
            e.AddComponent(FactionComponent.Create(faction));
            e.AddComponent(OnDeathComponent.Create(new List <string>()
            {
                OnDeathEffectType.REMOVE_FROM_UNIT
            }));
            e.AddComponent(SpeedComponent.Create(baseSpeed: 100));
            e.AddComponent(statusEffectTrackerComponent);
            e.AddComponent(UnitComponent.Create(unit.UnitId, formationNumber));
            e.AddComponent(XPValueComponent.Create(xpValue: 30));

            return(e);
        }
Ejemplo n.º 13
0
        public static Entity CreateStairsEntity()
        {
            var e = CreateEntity(Guid.NewGuid().ToString(), "jump point");

            e.AddComponent(DisplayComponent.Create(_texJumpPointPath, "The jump point to the next sector.", true, ITEM_Z_INDEX));
            e.AddComponent(StairsComponent.Create());

            return(e);
        }
Ejemplo n.º 14
0
        public static Entity CreateEdgeBlockerEntity()
        {
            var e = CreateEntity(Guid.NewGuid().ToString(), "boundary sign");

            e.AddComponent(CollisionComponent.Create(true, false));
            e.AddComponent(DefenderComponent.Create(0, 100, logDamage: false, isInvincible: true));
            e.AddComponent(DisplayComponent.Create(_texEdgeBlockerPath, "Trying to run away, eh? Get back to your mission!", true, ENTITY_Z_INDEX));

            return(e);
        }
Ejemplo n.º 15
0
        public static Entity CreateSatelliteEntity()
        {
            var e = CreateEntity(Guid.NewGuid().ToString(), "satellite");

            e.AddComponent(CollisionComponent.Create(blocksMovement: true, blocksVision: true));
            e.AddComponent(DefenderComponent.Create(baseDefense: int.MaxValue, maxHp: int.MaxValue, isInvincible: true, logDamage: false));
            e.AddComponent(DisplayComponent.Create(_texSatellitePath, "Space junk. Blocks movement and projectiles. Cannot be destroyed.", true, ENTITY_Z_INDEX));

            return(e);
        }
Ejemplo n.º 16
0
        public static Entity CreateIntelEntity(int targetDungeonLevel)
        {
            var e = CreateEntity(Guid.NewGuid().ToString(), "intel for sector " + targetDungeonLevel);

            e.AddComponent(DisplayComponent.Create(_texIntelPath, "Intel! Gives you zone information for the next sector. You want this.", true, ITEM_Z_INDEX));
            e.AddComponent(StorableComponent.Create());
            e.AddComponent(UsableComponent.Create(useOnGet: true));
            e.AddComponent(UseEffectAddIntelComponent.Create(targetDungeonLevel));

            return(e);
        }
Ejemplo n.º 17
0
        private static Entity CreateRedPaintEntity()
        {
            var e = CreateEntity(Guid.NewGuid().ToString(), "red paint");

            e.AddComponent(DisplayComponent.Create(_texRedPaintPath, "Reduces turn time by 75 for 300 ticks (minimum time is 1).", true, ITEM_Z_INDEX));
            e.AddComponent(StorableComponent.Create());
            e.AddComponent(UsableComponent.Create(useOnGet: false));
            e.AddComponent(UseEffectBoostSpeedComponent.Create(boostPower: 75, duration: 300));

            return(e);
        }
Ejemplo n.º 18
0
        private static Entity CreateDuctTapeEntity()
        {
            var e = CreateEntity(Guid.NewGuid().ToString(), "duct tape");

            e.AddComponent(DisplayComponent.Create(_texDuctTapePath, "Some duct tape. Heals 10 HP.", true, ITEM_Z_INDEX));
            e.AddComponent(StorableComponent.Create());
            e.AddComponent(UsableComponent.Create(useOnGet: false));
            e.AddComponent(UseEffectHealComponent.Create(healpower: 10));

            return(e);
        }
Ejemplo n.º 19
0
        private static Entity CreateExtraBatteryEntity()
        {
            var e = CreateEntity(Guid.NewGuid().ToString(), "extra battery");

            e.AddComponent(DisplayComponent.Create(_texBatteryPath, "An extra battery for your weapons. Gives 20 power for 450 ticks.", true, ITEM_Z_INDEX));
            e.AddComponent(StorableComponent.Create());
            e.AddComponent(UsableComponent.Create(useOnGet: false));
            e.AddComponent(UseEffectBoostPowerComponent.Create(boostPower: 20, duration: 450));

            return(e);
        }
Ejemplo n.º 20
0
        private static Entity CreateEMPEntity()
        {
            var e = CreateEntity(Guid.NewGuid().ToString(), "EMP");

            e.AddComponent(DisplayComponent.Create(_texEMPPath, "An EMP burst. Disables enemies for 10 turns in radius 20.", true, ITEM_Z_INDEX));
            e.AddComponent(StorableComponent.Create());
            e.AddComponent(UsableComponent.Create(useOnGet: false));
            // I seriously put 20 radius 10 turns? That's enough time to mop up an entire encounter!
            e.AddComponent(UseEffectEMPComponent.Create(radius: 20, disableTurns: 10));

            return(e);
        }
Ejemplo n.º 21
0
        public void SerializesAndDeserializesCorrectly()
        {
            var    component = DisplayComponent.Create("path", "description", true, 4);
            string saved     = component.Save();

            var newComponent = DisplayComponent.Create(saved);

            Assert.Equal(component.TexturePath, newComponent.TexturePath);
            Assert.Equal(component.Description, newComponent.Description);
            Assert.Equal(component.VisibleInFoW, newComponent.VisibleInFoW);
            Assert.Equal(component.ZIndex, 4);
        }
Ejemplo n.º 22
0
        public RenderXnaCommand(
			DisplayComponent displayComponent,
			PiktoViewManager pictoViewManager,
			ToolArtNetwork toolArtNetwork,
			MDetector md,
			Image<Bgr, Byte> img,
			MarkerPosition3D pos)
        {
            this.displayComponent = displayComponent;
            this.piktoViewMan = pictoViewManager;
            this.toolNetwork = toolArtNetwork;
            this.md = md;
            this.img = img;
            this.pos = pos;
        }
Ejemplo n.º 23
0
        public static Entity CreateProjectileEntity(Entity source, ProjectileType type, int power, EncounterPath path, int speed, int currentTick)
        {
            var displayData = projectileTypeToProjectileDisplay[type];

            var e = CreateEntity(Guid.NewGuid().ToString(), displayData.Name);

            e.AddComponent(PathAIComponent.Create(path));

            e.AddComponent(ActionTimeComponent.Create(currentTick)); // Should it go instantly or should it wait for its turn...?
            e.AddComponent(AttackerComponent.Create(source.EntityId, power));
            e.AddComponent(CollisionComponent.Create(false, false, true, true));
            e.AddComponent(DisplayComponent.Create(displayData.TexturePath, "A projectile.", false, PROJECTILE_Z_INDEX));
            e.AddComponent(SpeedComponent.Create(speed));

            return(e);
        }
Ejemplo n.º 24
0
        private static Entity CreateScoutEntity(string activationGroupId, int currentTick)
        {
            var e = CreateEntity(Guid.NewGuid().ToString(), "scout");

            var statusEffectTrackerComponent = StatusEffectTrackerComponent.Create();

            e.AddComponent(new ScoutAIComponent(activationGroupId));

            e.AddComponent(ActionTimeComponent.Create(currentTick));
            e.AddComponent(CollisionComponent.CreateDefaultActor());
            e.AddComponent(DefenderComponent.Create(baseDefense: 0, maxHp: 10));
            e.AddComponent(DisplayComponent.Create(_texScoutPath, "A small scout craft, armed with a shotgun.", false, ENTITY_Z_INDEX));
            e.AddComponent(SpeedComponent.Create(baseSpeed: 75));
            e.AddComponent(statusEffectTrackerComponent);
            e.AddComponent(XPValueComponent.Create(xpValue: 30));

            return(e);
        }
Ejemplo n.º 25
0
        private static Entity CreateDestroyerEntity(string activationGroupId, int currentTick)
        {
            var e = CreateEntity(Guid.NewGuid().ToString(), "destroyer");

            var statusEffectTrackerComponent = StatusEffectTrackerComponent.Create();

            e.AddComponent(new DestroyerAIComponent(activationGroupId));

            e.AddComponent(ActionTimeComponent.Create(currentTick));
            e.AddComponent(CollisionComponent.CreateDefaultActor());
            e.AddComponent(DefenderComponent.Create(baseDefense: 15, maxHp: 200));
            e.AddComponent(DisplayComponent.Create(_texDestroyerPath, "A larger anti-fighter craft with a ferocious flak barrage.", false, ENTITY_Z_INDEX));
            e.AddComponent(SpeedComponent.Create(baseSpeed: 300));
            e.AddComponent(statusEffectTrackerComponent);
            e.AddComponent(XPValueComponent.Create(xpValue: 500));

            return(e);
        }
Ejemplo n.º 26
0
        public static Entity CreateCommanderEntity(int currentTick, FactionName faction)
        {
            var e = CreateEntity(Guid.NewGuid().ToString(), "Hidden Commander Unit");

            var statusEffectTrackerComponent = StatusEffectTrackerComponent.Create();

            e.AddComponent(new CommanderAIComponent());

            e.AddComponent(ActionTimeComponent.Create(currentTick));
            e.AddComponent(CollisionComponent.CreateDefaultActor());
            e.AddComponent(DefenderComponent.Create(9999, 9999, 9999, 9999, 9999, isInvincible: true));
            e.AddComponent(DisplayComponent.Create(_texTriariusPath, "Hidden Commander Unit", false, ENTITY_Z_INDEX, visible: false));
            e.AddComponent(FactionComponent.Create(faction));
            e.AddComponent(SpeedComponent.Create(baseSpeed: 100));
            e.AddComponent(XPValueComponent.Create(xpValue: 9999));

            return(e);
        }
Ejemplo n.º 27
0
        private static Entity CreateCruiserEntity(string activationGroupId, int currentTick)
        {
            var e = CreateEntity(Guid.NewGuid().ToString(), "cruiser");

            var statusEffectTrackerComponent = StatusEffectTrackerComponent.Create();

            e.AddComponent(new CruiserAIComponent(activationGroupId));

            e.AddComponent(ActionTimeComponent.Create(currentTick));
            e.AddComponent(CollisionComponent.CreateDefaultActor());
            e.AddComponent(DefenderComponent.Create(baseDefense: 10, maxHp: 300));
            e.AddComponent(DisplayComponent.Create(_texCruiserPath, "A heavily armed and armored behemoth with a ferocious railgun.", false, ENTITY_Z_INDEX));
            e.AddComponent(SpeedComponent.Create(baseSpeed: 400));
            e.AddComponent(statusEffectTrackerComponent);
            e.AddComponent(XPValueComponent.Create(xpValue: 1000));

            return(e);
        }
Ejemplo n.º 28
0
        private static Entity CreateCarrierEntity(string activationGroupId, int currentTick)
        {
            var e = CreateEntity(Guid.NewGuid().ToString(), "carrier");

            var statusEffectTrackerComponent = StatusEffectTrackerComponent.Create();

            e.AddComponent(new CarrierAIComponent(activationGroupId));

            e.AddComponent(ActionTimeComponent.Create(currentTick));
            e.AddComponent(CollisionComponent.CreateDefaultActor());
            e.AddComponent(DefenderComponent.Create(baseDefense: 0, maxHp: 500));
            e.AddComponent(DisplayComponent.Create(_texCarrierPath, "An extremely slow carrier, which launches fighters or scouts every action.", false, ENTITY_Z_INDEX));
            e.AddComponent(SpeedComponent.Create(baseSpeed: 200));
            e.AddComponent(statusEffectTrackerComponent);
            e.AddComponent(XPValueComponent.Create(xpValue: 2000));

            return(e);
        }
Ejemplo n.º 29
0
        private static Entity CreateFrigateEntity(string activationGroupId, int currentTick)
        {
            var e = CreateEntity(Guid.NewGuid().ToString(), "frigate");

            var statusEffectTrackerComponent = StatusEffectTrackerComponent.Create();

            e.AddComponent(new FrigateAIComponent(activationGroupId));

            e.AddComponent(ActionTimeComponent.Create(currentTick));
            e.AddComponent(CollisionComponent.CreateDefaultActor());
            e.AddComponent(DefenderComponent.Create(baseDefense: 10, maxHp: 150));
            e.AddComponent(DisplayComponent.Create(_texFrigatePath, "An escort ship sporting a reverser gun, as well as secondary batteries.", false, ENTITY_Z_INDEX));
            e.AddComponent(SpeedComponent.Create(baseSpeed: 250));
            e.AddComponent(statusEffectTrackerComponent);
            e.AddComponent(XPValueComponent.Create(xpValue: 200));

            return(e);
        }
Ejemplo n.º 30
0
        private static Entity CreateFighterEntity(string activationGroupId, int currentTick)
        {
            var e = CreateEntity(Guid.NewGuid().ToString(), "fighter");

            var statusEffectTrackerComponent = StatusEffectTrackerComponent.Create();

            e.AddComponent(new FighterAIComponent(activationGroupId));

            e.AddComponent(ActionTimeComponent.Create(currentTick));
            e.AddComponent(CollisionComponent.CreateDefaultActor());
            e.AddComponent(DefenderComponent.Create(baseDefense: 0, maxHp: 30));
            e.AddComponent(DisplayComponent.Create(_texFighterPath, "An interceptor craft armed with a rapid-fire cannon.", false, ENTITY_Z_INDEX));
            e.AddComponent(SpeedComponent.Create(baseSpeed: 125));
            e.AddComponent(statusEffectTrackerComponent);
            e.AddComponent(XPValueComponent.Create(xpValue: 50));

            return(e);
        }
Ejemplo n.º 31
0
        private static Entity CreateGunshipEntity(string activationGroupId, int currentTick)
        {
            var e = CreateEntity(Guid.NewGuid().ToString(), "gunship");

            var statusEffectTrackerComponent = StatusEffectTrackerComponent.Create();

            e.AddComponent(new GunshipAIComponent(activationGroupId));

            e.AddComponent(ActionTimeComponent.Create(currentTick));
            e.AddComponent(CollisionComponent.CreateDefaultActor());
            e.AddComponent(DefenderComponent.Create(baseDefense: 4, maxHp: 50));
            e.AddComponent(DisplayComponent.Create(_texGunshipPath, "A sturdy gunship, armed with anti-fighter flak and a cannon.", false, ENTITY_Z_INDEX));
            e.AddComponent(SpeedComponent.Create(baseSpeed: 100));
            e.AddComponent(statusEffectTrackerComponent);
            e.AddComponent(XPValueComponent.Create(xpValue: 100));

            return(e);
        }