private static void LogAttack(DefenderComponent defenderComponent, string message, EncounterState state) { if (defenderComponent.ShouldLogDamage) { state.LogMessage(message); } }
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); }
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); }
private static void LogAttack(Entity attacker, Entity defender, DefenderComponent defenderComponent, string message, EncounterState state) { if (defenderComponent.ShouldLogDamage && (attacker == state.Player || defender == state.Player)) { state.LogMessage(message); } }
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); }
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); }
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); }
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); }
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); }
public void IncludesEntityGroup() { var component = DefenderComponent.Create(0, 0); JsonElement deserialized = JsonSerializer.Deserialize <JsonElement>(component.Save()); Assert.Equal(DefenderComponent.ENTITY_GROUP, deserialized.GetProperty("EntityGroup").GetString()); }
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); }
public void SerializesAndDeserializesCorrectly() { // I attempted to mock this, but both NSubstitute and Moq apparently have serious issues with mocking the GetCOmponent<T> // call, and would crash. So...TODO: look into mocking! var entity = Entity.Create("", ""); var defenderComponent = DefenderComponent.Create(10, 10); entity.AddComponent(defenderComponent); var component = XPTrackerComponent.Create(45, 97); component.AddXP(39500); component.RegisterLevelUpChoice(entity, LevelUpBonus.MAX_HP); component.RegisterLevelUpChoice(entity, LevelUpBonus.REPAIR); string saved = component.Save(); var newComponent = XPTrackerComponent.Create(saved); Assert.Equal(component.LevelUpBase, newComponent.LevelUpBase); Assert.Equal(component.LevelUpFactor, newComponent.LevelUpFactor); Assert.Equal(component.XP, newComponent.XP); Assert.Equal(component.Level, newComponent.Level); Assert.Equal(component.UnusedLevelUps.Count, newComponent.UnusedLevelUps.Count); Assert.Equal(component.UnusedLevelUps[0], newComponent.UnusedLevelUps[0]); Assert.Equal(component.UnusedLevelUps[1], newComponent.UnusedLevelUps[1]); Assert.Equal(component.NextLevelAtXP, newComponent.NextLevelAtXP); Assert.Equal(component.XPToNextLevel, newComponent.XPToNextLevel); Assert.Equal(component.ChosenLevelUps[2], newComponent.ChosenLevelUps[2]); Assert.Equal(component.ChosenLevelUps[3], newComponent.ChosenLevelUps[3]); }
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); }
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); }
protected override void Update(uint dt) { Board board = Service.BoardController.Board; for (MovementNode movementNode = this.nodeList.Head; movementNode != null; movementNode = movementNode.Next) { SmartEntity smartEntity = (SmartEntity)movementNode.Entity; if (smartEntity.StateComp.CurState == EntityState.Moving && smartEntity.PathingComp.CurrentPath != null) { smartEntity.PathingComp.TimeOnSegment += dt; if ((ulong)smartEntity.PathingComp.TimeOnSegment > (ulong)((long)smartEntity.PathingComp.TimeToMove)) { BoardCell boardCell = smartEntity.PathingComp.GetNextTile(); if (boardCell == null) { if (smartEntity.DroidComp == null) { Service.ShooterController.StopMoving(smartEntity.StateComp); } Service.EventManager.SendEvent(EventId.TroopReachedPathEnd, smartEntity); smartEntity.PathingComp.CurrentPath = null; } else { smartEntity.TransformComp.X = boardCell.X; smartEntity.TransformComp.Z = boardCell.Z; board.MoveChild(smartEntity.BoardItemComp.BoardItem, smartEntity.TransformComp.CenterGridX(), smartEntity.TransformComp.CenterGridZ(), null, false, false); PathView pathView = smartEntity.PathingComp.PathView; BoardCell nextTurn = pathView.GetNextTurn(); if (nextTurn.X == boardCell.X && nextTurn.Z == boardCell.Z) { pathView.AdvanceNextTurn(); } boardCell = smartEntity.PathingComp.AdvanceNextTile(); if (boardCell != null) { bool flag = smartEntity.TransformComp.X != boardCell.X && smartEntity.TransformComp.Z != boardCell.Z; smartEntity.PathingComp.TimeToMove += ((!flag) ? 1000 : 1414) * smartEntity.PathingComp.TimePerBoardCellMs / 1000; } else { DefenderComponent defenderComp = smartEntity.DefenderComp; if (defenderComp != null) { defenderComp.Patrolling = false; } } } } } } }
public bool FindTargetForTroopNode(SmartEntity entity, bool onlyUpdateIfNewTargetFound) { if (entity.TroopComp.TroopShooterVO.TargetLocking && entity.ShooterComp.Target != null) { return(!onlyUpdateIfNewTargetFound); } if (!onlyUpdateIfNewTargetFound) { entity.ShooterComp.Target = null; } if (entity.TroopComp.TroopShooterVO.TargetSelf) { return(this.UpdateShooterTarget(onlyUpdateIfNewTargetFound, entity, entity)); } bool flag = false; if (TroopController.IsEntityHealer(entity)) { SmartEntity smartEntity = this.FindBestTargetForHealer(entity); flag = this.UpdateShooterTarget(onlyUpdateIfNewTargetFound, entity, smartEntity); } else if (entity.TeamComp.TeamType == TeamType.Attacker) { SmartEntity smartEntity = this.FindTargetForAttacker(entity); if (smartEntity != null && entity.ShooterComp != null && entity.ShooterComp.ShooterVO.NewTargetOnReload) { entity.ShooterComp.AddEntityTargetIdToHistory(smartEntity.ID); } flag = this.UpdateShooterTarget(onlyUpdateIfNewTargetFound, entity, smartEntity); } else if (entity.TeamComp.TeamType == TeamType.Defender) { DefenderComponent defenderComp = entity.DefenderComp; SmartEntity smartEntity = this.FindOffensiveTroopAsTarget(entity); flag = this.UpdateShooterTarget(onlyUpdateIfNewTargetFound, entity, smartEntity); if (smartEntity != null && entity.ShooterComp != null && entity.ShooterComp.ShooterVO.NewTargetOnReload) { entity.ShooterComp.AddEntityTargetIdToHistory(smartEntity.ID); } if (flag) { entity.DefenderComp.Patrolling = false; } else if ((defenderComp.Leashed || !entity.ShooterComp.FirstTargetAcquired) && !onlyUpdateIfNewTargetFound && entity.StateComp.CurState != EntityState.Disable) { this.TroopWandering(entity); } } return(flag); }
private void TroopWandering(SmartEntity entity) { BoardController boardController = Service.BoardController; DefenderComponent defenderComp = entity.DefenderComp; if (defenderComp == null || defenderComp.Patrolling) { return; } TransformComponent transformComp = entity.TransformComp; if (transformComp == null) { return; } defenderComp.Patrolling = true; int x = transformComp.X; int z = transformComp.Z; BoardCell cellAt = boardController.Board.GetCellAt(x, z); int num = defenderComp.PatrolLoc; int num2 = (defenderComp.SpawnBuilding != null) ? 4 : 8; int viewRange = (int)entity.ShooterComp.ShooterVO.ViewRange; for (int i = 0; i < num2; i++) { BoardCell boardCell; if (defenderComp.SpawnBuilding == null) { num = (num + 1) % num2; int x2 = defenderComp.SpawnX + viewRange * TargetingController.x_mul[num] / TargetingController.x_div[num] / 2; int z2 = defenderComp.SpawnZ + viewRange * TargetingController.z_mul[num] / TargetingController.z_div[num] / 2; boardCell = boardController.Board.GetClampedToBoardCellAt(x2, z2, entity.SizeComp.Width); } else { boardCell = defenderComp.SpawnBuilding.FindNextPatrolPoint(entity.SizeComp.Width, ref num); } if (boardCell.IsWalkable()) { if (Service.PathingManager.StartPathingWorkerOrPatrol(entity, null, cellAt, boardCell, entity.SizeComp.Width, entity.TroopComp != null && TroopController.CanEntityCrushWalls(entity))) { Service.ShooterController.StartMoving(entity); defenderComp.PatrolLoc = num; Service.ShooterController.StopSearch(entity.ShooterComp); return; } } } entity.StateComp.CurState = EntityState.Idle; }
public void SerializesAndDeserializesCorrectly() { var component = DefenderComponent.Create(95, 11, currentHp: 3, logDamage: false, isInvincible: true); string saved = component.Save(); var newComponent = DefenderComponent.Create(saved); Assert.Equal(component.BaseDefense, newComponent.BaseDefense); Assert.Equal(component.Defense, newComponent.Defense); Assert.Equal(component.MaxHp, newComponent.MaxHp); Assert.Equal(component.CurrentHp, newComponent.CurrentHp); Assert.Equal(component.ShouldLogDamage, newComponent.ShouldLogDamage); Assert.Equal(component.IsInvincible, newComponent.IsInvincible); }
private void EnsureTetheredDistance(SmartEntity entity) { DefenderComponent defenderComp = entity.DefenderComp; TransformComponent transformComp = entity.TransformComp; if (defenderComp == null || transformComp == null) { return; } ShooterComponent shooterComp = entity.ShooterComp; if (shooterComp.Target != null && (long)GameUtils.SquaredDistance(transformComp.CenterGridX(), transformComp.CenterGridZ(), defenderComp.SpawnX, defenderComp.SpawnZ) > (long)((ulong)(shooterComp.ShooterVO.ViewRange * shooterComp.ShooterVO.ViewRange))) { Service.TargetingController.InvalidateCurrentTarget(entity); } }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
private static Entity CreateDiplomatEntity(string activationGroupId, int currentTick) { var e = CreateEntity(Guid.NewGuid().ToString(), "diplomat"); var statusEffectTrackerComponent = StatusEffectTrackerComponent.Create(); e.AddComponent(new DiplomatAIComponent(activationGroupId)); e.AddComponent(ActionTimeComponent.Create(currentTick)); e.AddComponent(CollisionComponent.CreateDefaultActor()); e.AddComponent(DefenderComponent.Create(baseDefense: 0, maxHp: 100)); e.AddComponent(DisplayComponent.Create(_texDiplomatPath, "Your target, the diplomat!", false, ENTITY_Z_INDEX)); e.AddComponent(OnDeathComponent.Create(new List <string>() { OnDeathEffectType.PLAYER_VICTORY })); e.AddComponent(SpeedComponent.Create(baseSpeed: 100)); e.AddComponent(statusEffectTrackerComponent); e.AddComponent(XPValueComponent.Create(xpValue: 0)); return(e); }
public static Entity CreatePlayerEntity(int currentTick) { var e = CreateEntity(Guid.NewGuid().ToString(), "player"); var statusEffectTrackerComponent = StatusEffectTrackerComponent.Create(); e.AddComponent(ActionTimeComponent.Create(currentTick)); e.AddComponent(CollisionComponent.Create(blocksMovement: true, blocksVision: false)); e.AddComponent(DefenderComponent.Create(baseDefense: 0, maxHp: 100, isInvincible: false)); e.AddComponent(DisplayComponent.Create(_texPlayerPath, "It's you!", false, ENTITY_Z_INDEX)); e.AddComponent(InventoryComponent.Create(inventorySize: 26)); e.AddComponent(OnDeathComponent.Create(new List <string>() { OnDeathEffectType.PLAYER_DEFEAT })); e.AddComponent(PlayerComponent.Create()); e.AddComponent(SpeedComponent.Create(baseSpeed: 100)); e.AddComponent(statusEffectTrackerComponent); e.AddComponent(XPTrackerComponent.Create(levelUpBase: 200, levelUpFactor: 150)); return(e); }
public override object Remove(Type compCls) { if (compCls == typeof(AreaTriggerComponent)) { this.AreaTriggerComp = null; } else if (compCls == typeof(ArmoryComponent)) { this.ArmoryComp = null; } else if (compCls == typeof(AssetComponent)) { this.AssetComp = null; } else if (compCls == typeof(AttackerComponent)) { this.AttackerComp = null; } else if (compCls == typeof(BarracksComponent)) { this.BarracksComp = null; } else if (compCls == typeof(BoardItemComponent)) { this.BoardItemComp = null; } else if (compCls == typeof(BuildingAnimationComponent)) { this.BuildingAnimationComp = null; } else if (compCls == typeof(BuildingComponent)) { this.BuildingComp = null; } else if (compCls == typeof(CantinaComponent)) { this.CantinaComp = null; } else if (compCls == typeof(ChampionComponent)) { this.ChampionComp = null; } else if (compCls == typeof(CivilianComponent)) { this.CivilianComp = null; } else if (compCls == typeof(ClearableComponent)) { this.ClearableComp = null; } else if (compCls == typeof(DamageableComponent)) { this.DamageableComp = null; } else if (compCls == typeof(DefenderComponent)) { this.DefenderComp = null; } else if (compCls == typeof(DefenseLabComponent)) { this.DefenseLabComp = null; } else if (compCls == typeof(DroidComponent)) { this.DroidComp = null; } else if (compCls == typeof(DroidHutComponent)) { this.DroidHutComp = null; } else if (compCls == typeof(SquadBuildingComponent)) { this.SquadBuildingComp = null; } else if (compCls == typeof(NavigationCenterComponent)) { this.NavigationCenterComp = null; } else if (compCls == typeof(FactoryComponent)) { this.FactoryComp = null; } else if (compCls == typeof(FleetCommandComponent)) { this.FleetCommandComp = null; } else if (compCls == typeof(FollowerComponent)) { this.FollowerComp = null; } else if (compCls == typeof(GameObjectViewComponent)) { this.GameObjectViewComp = null; } else if (compCls == typeof(GeneratorComponent)) { this.GeneratorComp = null; } else if (compCls == typeof(GeneratorViewComponent)) { this.GeneratorViewComp = null; } else if (compCls == typeof(HealerComponent)) { this.HealerComp = null; } else if (compCls == typeof(HealthComponent)) { this.HealthComp = null; } else if (compCls == typeof(TroopShieldComponent)) { this.TroopShieldComp = null; } else if (compCls == typeof(TroopShieldViewComponent)) { this.TroopShieldViewComp = null; } else if (compCls == typeof(TroopShieldHealthComponent)) { this.TroopShieldHealthComp = null; } else if (compCls == typeof(HealthViewComponent)) { this.HealthViewComp = null; } else if (compCls == typeof(HQComponent)) { this.HQComp = null; } else if (compCls == typeof(KillerComponent)) { this.KillerComp = null; } else if (compCls == typeof(LootComponent)) { this.LootComp = null; } else if (compCls == typeof(MeterShaderComponent)) { this.MeterShaderComp = null; } else if (compCls == typeof(OffenseLabComponent)) { this.OffenseLabComp = null; } else if (compCls == typeof(PathingComponent)) { this.PathingComp = null; } else if (compCls == typeof(SecondaryTargetsComponent)) { this.SecondaryTargetsComp = null; } else if (compCls == typeof(ShieldBorderComponent)) { this.ShieldBorderComp = null; } else if (compCls == typeof(ShieldGeneratorComponent)) { this.ShieldGeneratorComp = null; } else if (compCls == typeof(SizeComponent)) { this.SizeComp = null; } else if (compCls == typeof(ShooterComponent)) { this.ShooterComp = null; } else if (compCls == typeof(StarportComponent)) { this.StarportComp = null; } else if (compCls == typeof(StateComponent)) { this.StateComp = null; } else if (compCls == typeof(StorageComponent)) { this.StorageComp = null; } else if (compCls == typeof(SupportComponent)) { this.SupportComp = null; } else if (compCls == typeof(SupportViewComponent)) { this.SupportViewComp = null; } else if (compCls == typeof(TacticalCommandComponent)) { this.TacticalCommandComp = null; } else if (compCls == typeof(ChampionPlatformComponent)) { this.ChampionPlatformComp = null; } else if (compCls == typeof(TeamComponent)) { this.TeamComp = null; } else if (compCls == typeof(TrackingComponent)) { this.TrackingComp = null; } else if (compCls == typeof(TrackingGameObjectViewComponent)) { this.TrackingGameObjectViewComp = null; } else if (compCls == typeof(TransformComponent)) { this.TransformComp = null; } else if (compCls == typeof(TransportComponent)) { this.TransportComp = null; } else if (compCls == typeof(TroopComponent)) { this.TroopComp = null; } else if (compCls == typeof(TurretBuildingComponent)) { this.TurretBuildingComp = null; } else if (compCls == typeof(TurretShooterComponent)) { this.TurretShooterComp = null; } else if (compCls == typeof(WalkerComponent)) { this.WalkerComp = null; } else if (compCls == typeof(WallComponent)) { this.WallComp = null; } else if (compCls == typeof(BuffComponent)) { this.BuffComp = null; } else if (compCls == typeof(TrapComponent)) { this.TrapComp = null; } else if (compCls == typeof(TrapViewComponent)) { this.TrapViewComp = null; } else if (compCls == typeof(HousingComponent)) { this.HousingComp = null; } else if (compCls == typeof(SpawnComponent)) { this.SpawnComp = null; } return(base.Remove(compCls)); }