public void HandleMinionPlayed(Entity entity) { if (!HandleAction) { return; } _lastPlayedMinionId = entity.Id; var exclude = new List <string>(); if (!entity.HasTag(GameTag.DORMANT)) { SaveSecret(Hunter.Snipe); exclude.Add(Hunter.Snipe); SaveSecret(Mage.ExplosiveRunes); exclude.Add(Mage.ExplosiveRunes); SaveSecret(Mage.PotionOfPolymorph); exclude.Add(Mage.PotionOfPolymorph); SaveSecret(Paladin.Repentance); exclude.Add(Paladin.Repentance); } if (FreeSpaceOnBoard) { SaveSecret(Mage.MirrorEntity); exclude.Add(Mage.MirrorEntity); SaveSecret(Rogue.Ambush); exclude.Add(Rogue.Ambush); } if (FreeSpaceInHand) { exclude.Add(Mage.FrozenClone); } //Hidden cache will only trigger if the opponent has a minion in hand. //We might not know this for certain - requires additional tracking logic. var cardsInOpponentsHand = Game.Entities.Select(kvp => kvp.Value).Where(e => e.IsInHand && e.IsControlledBy(Game.Opponent.Id)).ToList(); foreach (var cardInOpponentsHand in cardsInOpponentsHand) { EntititesInHandOnMinionsPlayed.Add(cardInOpponentsHand); } if (IsAnyMinionInOpponentsHand) { exclude.Add(Hunter.HiddenCache); } Exclude(exclude); }
public bool NewSecret(Entity entity) { if(entity == null || !entity.IsSecret || !entity.HasTag(GameTag.CLASS)) return false; if(entity.HasCardId) Exclude(entity.CardId, false); var secret = new Secret(entity); Secrets.Add(secret); OnNewSecret(secret); Refresh(); Log.Info(entity.ToString()); return true; }
public Secret(Entity entity) { if (!entity.IsSecret) { throw new ArgumentException(nameof(entity) + " is not a secret"); } if (!entity.HasTag(GameTag.CLASS)) { throw new ArgumentException(nameof(entity) + " has no CardClass"); } Entity = entity; Excluded = GetAllSecrets().ToDictionary(x => x, x => false); }
public bool NewSecret(Entity entity) { if (entity == null || !entity.IsSecret || !entity.HasTag(GameTag.CLASS)) { return(false); } if (entity.HasCardId) { Exclude(entity.CardId, false); } Secrets.Add(new Secret(entity)); OnSecretsChanged?.Invoke(GetSecretList()); Log.Info(entity.ToString()); return(true); }
public void HandleOpponentDamage(Entity entity) { if (!HandleAction) { return; } if (entity.IsHero && entity.IsControlledBy(Game.Opponent.Id)) { if (!entity.HasTag(GameTag.IMMUNE)) { Exclude(Paladin.EyeForAnEye); Exclude(Rogue.Evasion); OpponentTookDamageDuringTurns.Add(Game.GetTurnNumber()); } } }
private bool WasAttackedBy(Entity defender, Entity attacker) { if (!attacker.HasTag(GAME_TAG.ATTACKING)) { return(false); } if (!defender.HasTag(GAME_TAG.DEFENDING)) { return(false); } if (defender.GetTag(GAME_TAG.LAST_AFFECTED_BY) != attacker.GetEntityId()) { return(false); } return(true); }
public void HandleEntityLostArmor(Entity entity, int value) { if (value <= 0) { return; } if (entity != null) { if (entity.IsHero && entity.IsControlledBy(Game.Opponent.Id)) { if (!entity.HasTag(GameTag.IMMUNE)) { OpponentTookDamageDuringTurns.Add(Game.GetTurnNumber()); } } } }
protected override void OnAction(SpellStateType prevStateType) { base.OnAction(prevStateType); Entity entity = base.GetSourceCard().GetEntity(); Actor actor = SceneUtils.FindComponentInParents <Actor>(this); GameObject main = this.m_minionPieces.m_main; bool flag = entity.HasTag(GAME_TAG.PREMIUM); if (flag) { main = this.m_minionPieces.m_premium; SceneUtils.EnableRenderers(this.m_minionPieces.m_main, false); } GameObject portraitMesh = actor.GetPortraitMesh(); main.GetComponent <Renderer>().material = portraitMesh.GetComponent <Renderer>().sharedMaterial; main.SetActive(true); SceneUtils.EnableRenderers(main, true); if (entity.HasTaunt()) { if (flag) { this.m_minionPieces.m_taunt.GetComponent <Renderer>().material = this.m_premiumTauntMaterial; } this.m_minionPieces.m_taunt.SetActive(true); SceneUtils.EnableRenderers(this.m_minionPieces.m_taunt, true); } if (entity.IsElite()) { if (flag) { this.m_minionPieces.m_legendary.GetComponent <Renderer>().material = this.m_premiumEliteMaterial; } this.m_minionPieces.m_legendary.SetActive(true); SceneUtils.EnableRenderers(this.m_minionPieces.m_legendary, true); } this.m_attack.SetGameStringText(entity.GetATK().ToString()); this.m_health.SetGameStringText(entity.GetHealth().ToString()); }
public async void HandleEntityDamageAsync(Entity dealer, Entity target, int damage) { if (target != null) { if (target.IsHero && target.IsControlledBy(Game.Opponent.Id)) { if (!target.HasTag(GameTag.IMMUNE)) { Exclude(Paladin.EyeForAnEye); Exclude(Rogue.Evasion); OpponentTookDamageDuringTurns.Add(Game.GetTurnNumber()); } } if (dealer != null) { if (dealer.IsMinion && dealer.IsControlledBy(Game.Player.Id)) { if (!EntityDamageDealtHistory.TryGetValue(dealer.Id, out var history)) { EntityDamageDealtHistory[dealer.Id] = new Dictionary <int, int>(); } if (!EntityDamageDealtHistory[dealer.Id].TryGetValue(target.Id, out var targetHistory)) { EntityDamageDealtHistory[dealer.Id][target.Id] = 0; } EntityDamageDealtHistory[dealer.Id][target.Id] += damage; var damageDealt = EntityDamageDealtHistory[dealer.Id][target.Id]; await Game.GameTime.WaitForDuration(100); //We check both heaolth and zone because sometimes after the await the dealer's health will revert to that of the original card. if (damageDealt >= 3 && dealer.Health > 0 && (Zone)dealer.GetTag(GameTag.ZONE) != Zone.GRAVEYARD) { Exclude(Paladin.Reckoning); } } } } }
public async void HandleEntityDamageAsync(Entity dealer, Entity target, int damage) { if (target != null) { if (target.IsHero && target.IsControlledBy(Game.Opponent.Id)) { if (!target.HasTag(GameTag.IMMUNE)) { Exclude(Paladin.EyeForAnEye); Exclude(Rogue.Evasion); OpponentTookDamageDuringTurns.Add(Game.GetTurnNumber()); } } if (dealer != null) { if (dealer.IsMinion && dealer.IsControlledBy(Game.Player.Id)) { if (!EntityDamageDealtHistory.TryGetValue(dealer.Id, out var history)) { EntityDamageDealtHistory[dealer.Id] = new Dictionary <int, int>(); } if (!EntityDamageDealtHistory[dealer.Id].TryGetValue(target.Id, out var targetHistory)) { EntityDamageDealtHistory[dealer.Id][target.Id] = 0; } EntityDamageDealtHistory[dealer.Id][target.Id] += damage; var damageDealt = EntityDamageDealtHistory[dealer.Id][target.Id]; await Game.GameTime.WaitForDuration(100); if (damageDealt >= 3 && dealer.Health > 0) { Exclude(Paladin.Reckoning); } } } } }
public async void HandleCardPlayed(Entity entity) { if (!HandleAction) { return; } var exclude = new List <string>(); if (entity.IsSpell) { exclude.Add(Mage.Counterspell); if (Game.OpponentHandCount < 10) { exclude.Add(Mage.ManaBind); } if (Game.OpponentMinionCount < 7) { //CARD_TARGET is set after ZONE, wait for 50ms gametime before checking await Game.GameTime.WaitForDuration(50); if (entity.HasTag(GameTag.CARD_TARGET) && Game.Entities.TryGetValue(entity.GetTag(GameTag.CARD_TARGET), out Entity target) && target.IsMinion) { exclude.Add(Mage.Spellbender); } exclude.Add(Hunter.CatTrick); } } else if (entity.IsMinion && Game.PlayerMinionCount > 3) { exclude.Add(Paladin.SacredTrial); } Exclude(exclude); }
internal static Minion GetMinionFromEntity(Entity entity, IEnumerable <Entity> attachedEntities) { var minion = MinionFactory.GetMinionFromCardid(entity.Info.LatestCardId); minion.baseAttack = entity.GetTag(GameTag.ATK); minion.baseHealth = entity.GetTag(GameTag.HEALTH); minion.taunt = entity.HasTag(GameTag.TAUNT); minion.div = entity.HasTag(GameTag.DIVINE_SHIELD); minion.cleave = MinionFactory.cardIDsWithCleave.Contains(minion.cardID); minion.poisonous = entity.HasTag(GameTag.POISONOUS); minion.windfury = entity.HasTag(GameTag.WINDFURY); minion.megaWindfury = entity.HasTag(GameTag.MEGA_WINDFURY) || MinionFactory.cardIdsWithMegaWindfury.Contains(entity.CardId); minion.golden = entity.HasTag(GameTag.PREMIUM); minion.tier = entity.GetTag(GameTag.TECH_LEVEL); minion.reborn = entity.HasTag(GameTag.REBORN); //Vanilla health if (minion.golden && MinionFactory.cardIdsWithoutPremiumImplementations.Contains(entity.Info.LatestCardId)) { minion.vanillaHealth *= 2; } // Attached Deathrattles minion.mechDeathCount = attachedEntities.Count(x => x.CardId == ReplicatingMenace); minion.mechDeathCountGold = attachedEntities.Count(x => x.CardId == ReplicatingMenace_Golden); minion.plantDeathCount = attachedEntities.Count(x => x.CardId == LivingSpores); // Lich King hero power if (attachedEntities.Any(x => x.CardId == RebornRiteEnchmantment)) { minion.receivesLichKingPower = true; } minion.game_id = entity.Id; Log.Info($"Added {entity.Name}, ({minion.baseAttack}, {minion.baseHealth}, controller {entity.GetTag(GameTag.CONTROLLER)}, creator {entity.Info.GetCreatorId()}."); return(minion); }
protected override void OnProcessTaskList() { if ((((this.m_attackType == AttackType.ONLY_PROPOSED_ATTACKER) || (this.m_attackType == AttackType.ONLY_PROPOSED_DEFENDER)) || ((this.m_attackType == AttackType.ONLY_ATTACKER) || (this.m_attackType == AttackType.ONLY_DEFENDER))) || (((this.m_attackType == AttackType.WAITING_ON_PROPOSED_ATTACKER) || (this.m_attackType == AttackType.WAITING_ON_PROPOSED_DEFENDER)) || ((this.m_attackType == AttackType.WAITING_ON_ATTACKER) || (this.m_attackType == AttackType.WAITING_ON_DEFENDER)))) { this.FinishEverything(); } else { Card source = base.GetSource(); Entity entity = source.GetEntity(); Zone zone = source.GetZone(); bool flag = zone.m_Side == Player.Side.FRIENDLY; if (flag) { this.m_sourceAttackSpell = source.GetActorSpell(SpellType.FRIENDLY_ATTACK); } else { this.m_sourceAttackSpell = source.GetActorSpell(SpellType.OPPONENT_ATTACK); } if (this.m_attackType == AttackType.CANCELED) { if (this.m_sourceAttackSpell != null) { if (entity.IsHero()) { this.m_sourceAttackSpell.ActivateState(SpellStateType.CANCEL); } else { this.m_sourceAttackSpell.ActivateState(SpellStateType.DEATH); } } source.SetDoNotSort(false); zone.UpdateLayout(); source.EnableAttacking(false); this.FinishEverything(); } else { source.EnableAttacking(true); if (entity.HasTag(GAME_TAG.IMMUNE_WHILE_ATTACKING)) { source.ActivateActorSpell(SpellType.IMMUNE); } this.m_sourceAttackSpell.AddStateStartedCallback(new Spell.StateStartedCallback(this.OnSourceAttackStateStarted)); if (flag) { if (this.m_sourceAttackSpell.GetActiveState() != SpellStateType.IDLE) { this.m_sourceAttackSpell.ActivateState(SpellStateType.BIRTH); } else { this.m_sourceAttackSpell.ActivateState(SpellStateType.ACTION); } } else { this.m_sourceAttackSpell.ActivateState(SpellStateType.BIRTH); } } } }
private bool EntityIsRemovedFromGamePassive(Entity entity) => entity.HasTag(GameTag.DUNGEON_PASSIVE_BUFF) && entity.GetTag(GameTag.ZONE) == (int)Zone.REMOVEDFROMGAME;
internal static bool HeroPowerUsed(Entity heroPower) => heroPower != null && (heroPower.HasTag(GameTag.EXHAUSTED) || heroPower.HasTag(GameTag.BACON_HERO_POWER_ACTIVATED));
public void HandleAttack(Entity attacker, Entity defender, bool fastOnly = false) { if (!HandleAction) { return; } if (attacker.GetTag(GameTag.CONTROLLER) == defender.GetTag(GameTag.CONTROLLER)) { return; } var exclude = new List <string>(); var freeSpaceOnBoard = FreeSpaceOnBoard; if (freeSpaceOnBoard) { exclude.Add(Paladin.NobleSacrifice); } if (defender.IsHero) { if (!fastOnly && attacker.Health >= 1) { if (freeSpaceOnBoard) { exclude.Add(Hunter.BearTrap); } if (Game.Entities.Values.Any(x => x.IsInPlay && (x.IsHero || x.IsMinion) && !x.HasTag(GameTag.IMMUNE) && x != attacker && x != defender)) { exclude.Add(Hunter.Misdirection); } if (attacker.IsMinion) { if (Game.PlayerMinionCount > 1) { exclude.Add(Rogue.SuddenBetrayal); } exclude.Add(Mage.FlameWard); exclude.Add(Hunter.FreezingTrap); exclude.Add(Mage.Vaporize); if (FreeSpaceOnBoard) { exclude.Add(Rogue.ShadowClone); } } } if (freeSpaceOnBoard) { exclude.Add(Hunter.WanderingMonster); } exclude.Add(Mage.IceBarrier); exclude.Add(Hunter.ExplosiveTrap); } else { exclude.Add(Rogue.Bamboozle); if (!defender.HasTag(GameTag.DIVINE_SHIELD)) { exclude.Add(Paladin.AutodefenseMatrix); } if (freeSpaceOnBoard) { exclude.Add(Mage.SplittingImage); exclude.Add(Hunter.PackTactics); exclude.Add(Hunter.SnakeTrap); exclude.Add(Hunter.VenomstrikeTrap); } if (attacker.IsMinion) { exclude.Add(Hunter.FreezingTrap); } } Exclude(exclude); }
public void AddDecal(Vector3 point, Vector3 normal, string tag, Entity target) { if(normal == Vector3.zero) { return; } if (tag == "Wall") { float size = 0.07f + Random.Range (0f, 0.02f); Quaternion q = Quaternion.LookRotation (-normal); particleBulletPool[nextParticleBullet].transform.position = point; particleBulletPool[nextParticleBullet].transform.eulerAngles = new Vector3(q.eulerAngles.x - 90f, q.eulerAngles.y, q.eulerAngles.z); particleBulletPool[nextParticleBullet].init(); nextParticleBullet++; if(nextParticleBullet >= particleBulletPoolLength) { nextParticleBullet = 0; } q.eulerAngles = new Vector3 (q.eulerAngles.x, q.eulerAngles.y, q.eulerAngles.z + UnityEngine.Random.Range (0f, 360f)); verts [nextPool * 4] = point + (q * (Vector3.left * size)) + (q * (Vector3.up * size)) + q * (Vector3.back * 0.01f); verts [nextPool * 4 + 1] = point + (q * (Vector3.right * size)) + (q * (Vector3.up * size)) + q * (Vector3.back * 0.01f); verts [nextPool * 4 + 2] = point + (q * (Vector3.left * size)) + (q * (Vector3.down * size)) + q * (Vector3.back * 0.01f); verts [nextPool * 4 + 3] = point + (q * (Vector3.right * size)) + (q * (Vector3.down * size)) + q * (Vector3.back * 0.01f); nextPool = nextPool >= poolLenght - 1 ? 0 : nextPool + 1; meshUpdated = true; } else if(tag == "Obstacle") { Quaternion q = Quaternion.LookRotation(-normal); particleBulletPool[nextParticleBullet].transform.position = point; particleBulletPool[nextParticleBullet].transform.eulerAngles = new Vector3(q.eulerAngles.x - 90f, q.eulerAngles.y, q.eulerAngles.z); particleBulletPool[nextParticleBullet].init(); nextParticleBullet++; if(nextParticleBullet >= particleBulletPoolLength) { nextParticleBullet = 0; } } else if((tag == "Body" || tag == "Head" || tag == "Limbs") && target.HasTag("Enemy")) { Quaternion q = Quaternion.LookRotation (-normal); particleBloodPool [nextParticleBlood].transform.position = point; particleBloodPool [nextParticleBlood].transform.eulerAngles = new Vector3 (q.eulerAngles.x - 90f, q.eulerAngles.y, q.eulerAngles.z); particleBloodPool [nextParticleBlood].init (); nextParticleBlood++; if (nextParticleBlood >= particleBloodPoolLength) { nextParticleBlood = 0; } } }
public async void HandleCardPlayed(Entity entity) { if (!HandleAction) { return; } SavedSecrets.Clear(); var exclude = new List <string>(); if (FreeSpaceOnBoard) { if (Game.PlayerEntity?.GetTag(GameTag.NUM_CARDS_PLAYED_THIS_TURN) >= 3) { exclude.Add(Hunter.RatTrap); } } if (FreeSpaceInHand) { if (Game.PlayerEntity?.GetTag(GameTag.NUM_CARDS_PLAYED_THIS_TURN) >= 3) { exclude.Add(Paladin.HiddenWisdom); } } if (entity.IsSpell) { exclude.Add(Mage.Counterspell); if (Game.OpponentMinionCount > 0) { exclude.Add(Paladin.NeverSurrender); } if (Game.OpponentHandCount < 10) { exclude.Add(Mage.ManaBind); } if (Game.OpponentMinionCount < 7) { //CARD_TARGET is set after ZONE, wait for 50ms gametime before checking await Game.GameTime.WaitForDuration(50); if (entity.HasTag(GameTag.CARD_TARGET) && Game.Entities.TryGetValue(entity.GetTag(GameTag.CARD_TARGET), out Entity target) && target.IsMinion) { exclude.Add(Mage.Spellbender); } exclude.Add(Hunter.CatTrick); } } else if (entity.IsMinion && Game.PlayerMinionCount > 3) { exclude.Add(Paladin.SacredTrial); } Exclude(exclude); }
internal static bool HeroPowerUsed(Entity heroPower) => heroPower != null && (heroPower.HasTag(GameTag.EXHAUSTED) || heroPower.HasTag(GameTag.PENDING_TRIGGER));
public void HandleAttack(Entity attacker, Entity defender, bool fastOnly = false) { if (!HandleAction) { return; } if (attacker.GetTag(GameTag.CONTROLLER) == defender.GetTag(GameTag.CONTROLLER)) { return; } var exclude = new List <MultiIdCard>(); exclude.Add(Paladin.JudgmentOfJustice); var freeSpaceOnBoard = FreeSpaceOnBoard; if (freeSpaceOnBoard) { exclude.Add(Paladin.NobleSacrifice); } if (defender.IsHero) { if (!fastOnly && attacker.Health >= 1) { if (freeSpaceOnBoard) { exclude.Add(Hunter.BearTrap); } if (Game.Entities.Values.Any(x => x.IsInPlay && (x.IsHero || x.IsMinion) && !x.HasTag(GameTag.IMMUNE) && x != attacker && x != defender)) { exclude.Add(Hunter.Misdirection); } if (attacker.IsMinion) { if (Game.PlayerMinionCount > 1) { exclude.Add(Rogue.SuddenBetrayal); } exclude.Add(Mage.FlameWard); exclude.Add(Hunter.FreezingTrap); exclude.Add(Mage.Vaporize); if (FreeSpaceOnBoard) { exclude.Add(Rogue.ShadowClone); } } } if (freeSpaceOnBoard) { exclude.Add(Hunter.WanderingMonster); } exclude.Add(Mage.IceBarrier); exclude.Add(Hunter.ExplosiveTrap); } else { exclude.Add(Rogue.Bamboozle); if (!defender.HasTag(GameTag.DIVINE_SHIELD)) { exclude.Add(Paladin.AutodefenseMatrix); } if (freeSpaceOnBoard) { exclude.Add(Mage.SplittingImage); exclude.Add(Hunter.PackTactics); exclude.Add(Hunter.SnakeTrap); exclude.Add(Hunter.VenomstrikeTrap); //I think most of the secrets here could (and maybe should) check for this, but this one definitley does because of Hysteria. if (Game.PlayerEntity.IsCurrentPlayer) { exclude.Add(Mage.OasisAlly); } } if (attacker.IsMinion) { exclude.Add(Hunter.FreezingTrap); } } Exclude(exclude); }
private void PrepareHistoryForCurrentTaskList() { object[] args = new object[] { this.m_currentTaskList.GetId() }; Log.Power.Print("PowerProcessor.PrepareHistoryForCurrentTaskList() - m_currentTaskList={0}", args); Network.HistActionStart sourceAction = this.m_currentTaskList.GetSourceAction(); if (sourceAction != null) { if (sourceAction.BlockType != HistoryBlock.Type.ATTACK) { if (sourceAction.BlockType == HistoryBlock.Type.PLAY) { Entity playedEntity = GameState.Get().GetEntity(sourceAction.Entity); if (playedEntity != null) { if (this.m_currentTaskList.IsSourceActionOrigin()) { Entity targetedEntity = GameState.Get().GetEntity(sourceAction.Target); HistoryManager.Get().CreateCardPlayedTile(playedEntity, targetedEntity); this.m_currentTaskList.SetSpawnedHistoryTile(true); if (playedEntity.IsControlledByFriendlySidePlayer()) { GameState.Get().GetGameEntity().NotifyOfFriendlyPlayedCard(playedEntity); } if (this.ShouldShowPlayedBigCard(playedEntity)) { if (playedEntity.IsControlledByOpposingSidePlayer()) { GameState.Get().GetGameEntity().NotifyOfOpponentPlayedCard(playedEntity); } bool wasCountered = this.m_currentTaskList.WasThePlayedSpellCountered(playedEntity); this.m_historyBlocking = true; this.m_historyBlockingTaskList = this.m_currentTaskList; HistoryManager.Get().CreatePlayedBigCard(playedEntity, new HistoryManager.FinishedCallback(this.OnBigCardFinished), wasCountered); } } this.m_currentTaskList.NotifyHistoryOfAdditionalTargets(); } } else if (sourceAction.BlockType == HistoryBlock.Type.POWER) { this.m_currentTaskList.NotifyHistoryOfAdditionalTargets(); } else if (sourceAction.BlockType == HistoryBlock.Type.JOUST) { this.m_currentTaskList.NotifyHistoryOfAdditionalTargets(); } else if (sourceAction.BlockType == HistoryBlock.Type.TRIGGER) { Entity triggeredEntity = GameState.Get().GetEntity(sourceAction.Entity); if (triggeredEntity != null) { if (triggeredEntity.IsSecret()) { if (this.m_currentTaskList.IsSourceActionOrigin()) { HistoryManager.Get().CreateTriggerTile(triggeredEntity); this.m_currentTaskList.SetSpawnedHistoryTile(true); this.m_historyBlocking = true; this.m_historyBlockingTaskList = this.m_currentTaskList; HistoryManager.Get().CreateSecretBigCard(triggeredEntity, new HistoryManager.FinishedCallback(this.OnBigCardFinished)); } this.m_currentTaskList.NotifyHistoryOfAdditionalTargets(); } else { if (this.m_currentTaskList.IsSourceActionOrigin()) { PowerHistoryInfo powerHistoryInfo = triggeredEntity.GetPowerHistoryInfo(sourceAction.Index); if ((powerHistoryInfo != null) && powerHistoryInfo.ShouldShowInHistory()) { if (triggeredEntity.HasTag(GAME_TAG.HISTORY_PROXY)) { Entity entity6 = GameState.Get().GetEntity(triggeredEntity.GetTag(GAME_TAG.HISTORY_PROXY)); HistoryManager.Get().CreateCardPlayedTile(entity6, null); if ((triggeredEntity.GetController() != GameState.Get().GetFriendlySidePlayer()) || !triggeredEntity.HasTag(GAME_TAG.HISTORY_PROXY_NO_BIG_CARD)) { this.m_historyBlocking = true; this.m_historyBlockingTaskList = this.m_currentTaskList; HistoryManager.Get().CreateTriggeredBigCard(entity6, new HistoryManager.FinishedCallback(this.OnBigCardFinished)); } } else { if (this.ShouldShowTriggeredBigCard(triggeredEntity)) { this.m_historyBlocking = true; this.m_historyBlockingTaskList = this.m_currentTaskList; HistoryManager.Get().CreateTriggeredBigCard(triggeredEntity, new HistoryManager.FinishedCallback(this.OnBigCardFinished)); } HistoryManager.Get().CreateTriggerTile(triggeredEntity); } this.m_currentTaskList.SetSpawnedHistoryTile(true); } } if (this.m_currentTaskList.DidBlockSpawnHistoryTile()) { this.m_currentTaskList.NotifyHistoryOfAdditionalTargets(); } } } } else if (sourceAction.BlockType == HistoryBlock.Type.FATIGUE) { if (this.m_currentTaskList.IsSourceActionOrigin()) { HistoryManager.Get().CreateFatigueTile(); this.m_currentTaskList.SetSpawnedHistoryTile(true); } this.m_currentTaskList.NotifyHistoryOfAdditionalTargets(); } } else { AttackType attackType = this.m_currentTaskList.GetAttackType(); Entity attacker = null; Entity defender = null; switch (attackType) { case AttackType.REGULAR: attacker = this.m_currentTaskList.GetAttacker(); defender = this.m_currentTaskList.GetDefender(); break; case AttackType.CANCELED: attacker = this.m_currentTaskList.GetAttacker(); defender = this.m_currentTaskList.GetProposedDefender(); break; } if ((attacker != null) && (defender != null)) { HistoryManager.Get().CreateAttackTile(attacker, defender, this.m_currentTaskList); this.m_currentTaskList.SetSpawnedHistoryTile(true); this.m_currentTaskList.NotifyHistoryOfAdditionalTargets(); } } } }
/// <remarks> /// A renderable entity requires these components: /// <list type="bullet"> /// <item> /// <description><see cref="Material"/></description> /// </item> /// <item> /// <description><see cref="MeshData"/></description> /// </item> /// <item> /// <description>and <see cref="IBindableResource"/></description> /// </item> /// </list> /// </remarks> /// <param name="entity"></param> /// <returns>Whether this <see cref="Renderer"/> can operate on the given <see cref="Entity"/></returns> private static bool CanOperateOn(Entity entity) => entity.HasComponentsOfTypes ( typeof(Material), typeof(MeshData), typeof(IBindableResource) ) && entity.HasTag(Tags.Initialized);
public static bool IsInZone(this Entity entity, TAG_ZONE zone) { return(entity.HasTag(GAME_TAG.ZONE) && entity.GetTag(GAME_TAG.ZONE) == (int)zone); }
private Entity SporeBase(int mX, int mY, float mDegrees, int mSpeed, string mTextureName, bool mEnemy) { var result = new Entity(_manager); var cBody = Body(new SSVector2I(mX, mY), 250, 250); var cMovement = Movement(cBody); var cRender = Render(cBody, mTextureName); cBody.Body.AddGroupsToCheck(Groups.Obstacle, Groups.Character); cBody.Body.AddGroupsToIgnoreResolve(Groups.Obstacle, Groups.Character); cBody.OnCollision += (mCollisionInfo) => { var entity = (Entity)mCollisionInfo.UserData; var cHealth = entity.GetComponent<CHealth>(); if (result.HasTag(Tags.SporeBlack) && entity.HasTag(Tags.DamagedByWhite)) { cHealth++; result.Destroy(); } else if (result.HasTag(Tags.SporeWhite) && entity.HasTag(Tags.DamagedByBlack)) { cHealth++; result.Destroy(); } if (entity.HasTag(Tags.DestroysBullets)) result.Destroy(); }; cMovement.Angle = mDegrees; cMovement.Speed = mSpeed; cMovement.Acceleration = -0.1f; cRender.Torque = 8; result.AddComponents(cBody, cMovement, cRender); result.AddTags(Tags.Spore); cRender.Sprite.Color = new Color(255, 255, 255, 125); return result; }
public static bool IsHero(Entity e) => e.HasTag(CARDTYPE) && e.GetTag(CARDTYPE) == (int)CardType.HERO && e.HasTag(ZONE) && e.GetTag(ZONE) == (int)Zone.PLAY;
public static bool IsHero(Entity e) { return(e.HasTag(GAME_TAG.CARDTYPE) && e.GetTag(GAME_TAG.CARDTYPE) == (int)TAG_CARDTYPE.HERO && e.HasTag(GAME_TAG.ZONE) && e.GetTag(GAME_TAG.ZONE) == (int)TAG_ZONE.PLAY); }
private Entity BulletBase(int mX, int mY, float mDegrees, int mSpeed, string mTextureName, bool mEnemy) { var result = new Entity(_manager); var cBody = Body(new SSVector2I(mX, mY), 250, 250); var cMovement = Movement(cBody); var cRender = Render(cBody, mTextureName); cBody.Body.AddGroupsToCheck(Groups.Obstacle, Groups.Character); cBody.Body.AddGroupsToIgnoreResolve(Groups.Obstacle, Groups.Character); cBody.OnCollision += (mCollisionInfo) => { var entity = (Entity) mCollisionInfo.UserData; var cHealth = entity.GetComponent<CHealth>(); if (entity.HasTag(Tags.DamagedByAny)) { cHealth.Health--; result.Destroy(); } else if (result.HasTag(Tags.BulletFriendly) && entity.HasTag(Tags.DamagedByFriendly)) { cHealth.Health--; result.Destroy(); } else if (result.HasTag(Tags.BulletEnemy) && entity.HasTag(Tags.DamagedByEnemy)) { cHealth.Health--; result.Destroy(); } if (entity.HasTag(Tags.DestroysBullets)) result.Destroy(); }; cMovement.Angle = mDegrees; cMovement.Speed = mSpeed; cRender.Torque = 8; result.AddComponents(cBody, cMovement, cRender); result.AddTags(Tags.Bullet); return result; }
public static bool IsHero(Entity e) => e.HasTag(CARDTYPE) && e.GetTag(CARDTYPE) == (int)TAG_CARDTYPE.HERO && e.HasTag(ZONE) && e.GetTag(ZONE) == (int)TAG_ZONE.PLAY;
public async void HandleCardPlayed(Entity entity) { if (!HandleAction) { return; } SavedSecrets.Clear(); var exclude = new List <string>(); if (FreeSpaceOnBoard) { if (Game.PlayerEntity?.GetTag(GameTag.NUM_CARDS_PLAYED_THIS_TURN) >= 3) { exclude.Add(Hunter.RatTrap); } } if (FreeSpaceInHand) { if (Game.PlayerEntity?.GetTag(GameTag.NUM_CARDS_PLAYED_THIS_TURN) >= 3) { exclude.Add(Paladin.HiddenWisdom); } } if (entity.IsSpell) { _triggeredSecrets.Clear(); if (Game.OpponentSecretCount > 1) { await Game.GameTime.WaitForDuration(MultiSecretResolveDelay); } exclude.Add(Mage.Counterspell); if (_triggeredSecrets.FirstOrDefault(x => x.CardId == Mage.Counterspell) != null) { Exclude(exclude); return; } exclude.Add(Paladin.OhMyYogg); if (Game.OpponentMinionCount > 0) { exclude.Add(Paladin.NeverSurrender); } if (Game.OpponentHandCount < 10) { exclude.Add(Rogue.DirtyTricks); exclude.Add(Mage.ManaBind); } if (FreeSpaceOnBoard) { //CARD_TARGET is set after ZONE, wait for 50ms gametime before checking await Game.GameTime.WaitForDuration(50); if (entity.HasTag(GameTag.CARD_TARGET) && Game.Entities.TryGetValue(entity.GetTag(GameTag.CARD_TARGET), out Entity target) && target.IsMinion) { exclude.Add(Mage.Spellbender); } exclude.Add(Hunter.CatTrick); exclude.Add(Mage.NetherwindPortal); } if (Game.PlayerMinionCount > 0) { exclude.Add(Hunter.PressurePlate); } } else if (entity.IsMinion && Game.PlayerMinionCount > 3) { exclude.Add(Paladin.SacredTrial); } Exclude(exclude); }
public void HandleAttack(Entity attacker, Entity defender, bool fastOnly = false) { if (!HandleAction) { return; } if (attacker.GetTag(GameTag.CONTROLLER) == defender.GetTag(GameTag.CONTROLLER)) { return; } var exclude = new List <string>(); var freeSpaceOnBoard = FreeSpaceOnBoard; if (freeSpaceOnBoard) { exclude.Add(Paladin.NobleSacrifice); } if (defender.IsHero) { if (!fastOnly) { if (freeSpaceOnBoard && attacker.Health >= 1) { exclude.Add(Hunter.BearTrap); } exclude.Add(Mage.IceBarrier); } if (freeSpaceOnBoard) { exclude.Add(Hunter.WanderingMonster); } exclude.Add(Hunter.ExplosiveTrap); if (Game.IsMinionInPlay) { exclude.Add(Hunter.Misdirection); } if (attacker.IsMinion && Game.PlayerMinionCount > 1) { exclude.Add(Rogue.SuddenBetrayal); } if (attacker.IsMinion) { exclude.Add(Mage.Vaporize); if (attacker.Health >= 1) { exclude.Add(Hunter.FreezingTrap); } } } else { if (!defender.HasTag(GameTag.DIVINE_SHIELD)) { exclude.Add(Paladin.AutodefenseMatrix); } if (freeSpaceOnBoard) { exclude.Add(Mage.SplittingImage); if (!fastOnly) { exclude.Add(Hunter.SnakeTrap); exclude.Add(Hunter.VenomstrikeTrap); } } if (attacker.IsMinion) { exclude.Add(Hunter.FreezingTrap); } } Exclude(exclude); }
public static bool IsControlledBy(this Entity entity, int controller) { return(entity.HasTag(GAME_TAG.CONTROLLER) && entity.GetTag(GAME_TAG.CONTROLLER) == controller); }