public Minion(Minion basis) : base(basis) { this.minionId = basis.minionId; this.mtype = basis.mtype; this.permanentStats = basis.permanentStats; this.stats = basis.stats; this.slow_movedHalfWay = basis.slow_movedHalfWay; }
public Vector2 GetPosition(Minion minion) { if (finished) return minion.drawPos; MinionAnimationBatch batch = batches[currentBatch]; return batch.GetPosition(minion); }
public void AddAnimation(Minion minion, Vector2 startPos, Vector2 destination) { batches.Last().AddAnimation(minion, startPos, destination); }
public bool HasAnimation(Minion minion) { return animations.ContainsKey(minion.minionId); }
public Vector2 GetPosition(Minion minion) { if (animations.ContainsKey(minion.minionId)) { return animations[minion.minionId].GetPosition((float)(elapsedTime.TotalMilliseconds / duration.TotalMilliseconds)); } else { return minion.drawPos; } }
public void AddAnimation(Minion minion, Vector2 startPos, Vector2 destination) { animations[minion.minionId] = new MinionAnimationElement(startPos, destination); }
public void PlayTurn(Card c, Minion caster, TriggerItem target) { if (c.effect != null && c.effect is Effect_Rewind) { if (gameStates.Count <= 1) return; // rewind isn't really a spell like everything else gameStates.RemoveAt(gameStates.Count - 1); gameStateOnSkip = gameStates.Last().GetGameStateOnSkip(); selectionState = new UISelectionState(gameStates.Last()); } else { GameState oldGameState = gameStates.Last(); if (oldGameState.CanPlayCard(c, target)) { nextGameState = new GameState(gameStates.Last()); animation.Clear(); if (caster == null) caster = nextGameState.wizard; nextGameState.PlayCard(c, caster, nextGameState.Adapt(target), animation); nextGameState.TurnEffects(animation); gameStateOnSkip = nextGameState.GetGameStateOnSkip(); } } }
public void Attack(GameState gameState, Minion target, int bonusDamage, MinionAnimationBatch attackAnim, MinionAnimationBatch recoverAnim) { if (deleted) return; gameState.PayCost(mtype.attackCost); Vector2 basePos = drawPos; Vector2 targetPos = target.drawPos; targetPos = new Vector2(targetPos.X, targetPos.Y+target.type.texture.Height - type.texture.Height); Vector2 attackPos = basePos + (targetPos - basePos) * 0.5f; attackAnim.AddAnimation(this, basePos, attackPos); recoverAnim.AddAnimation(this, attackPos, basePos); DamageType damageType = stats.hasKeyword(Keyword.corrosive)? DamageType.acid: stats.hasKeyword(Keyword.fireform)? DamageType.fire: DamageType.attack; gameState.HandleTriggers(new TriggerEvent(TriggerType.onAttack, this, target)); target.TakeDamage(gameState, stats.attack+bonusDamage, damageType, this); }
public GameState(GameState parentState) { this.gameEndState = parentState.gameEndState; this.parentState = parentState; this.levelScript = parentState.levelScript; turnNumber = parentState.turnNumber; spawnIndices = new List<int>(); foreach (int spawnIndex in parentState.spawnIndices) { spawnIndices.Add(spawnIndex); } minions = new Dictionary<Point, Minion>(); foreach (KeyValuePair<Point, Minion> kv in parentState.minions) { Minion newP = new Minion(kv.Value); minions[newP.position] = newP; if (kv.Value == parentState.wizard) { wizard = newP; } } UpdateSpellSets(); ongoingEffects = new Dictionary<Point, Ongoing>(); foreach (KeyValuePair<Point, Ongoing> kv in parentState.ongoingEffects) { ongoingEffects.Add(kv.Key, new Ongoing(kv.Value)); } resources = new Dictionary<ResourceType, int>(parentState.resources); cardTextChanges = new Dictionary<Card, TextChanges>(); foreach (KeyValuePair<Card, TextChanges> kv in parentState.cardTextChanges) { cardTextChanges.Add(kv.Key, kv.Value); } playableCards = new HashSet<Card>(); }
public MinionMove(Minion m) { this.currentAnimPos = m.drawPos; this.minion = m; this.movesLeft = m.stats.move; }
public void PlayCard(Card c, Minion caster, TriggerItem target, MinionAnimationSequence animation) { PayCost(c.cost); HandleTriggers(new TriggerEvent(TriggerType.beforeSpells)); if(Card.get("wait") != c) HandleTriggers(new TriggerEvent(TriggerType.beforeActualSpell, c)); ApplyCardEffect(c, caster, target, animation); HandleTriggers(new TriggerEvent(TriggerType.afterSpells)); if (c.effect != null || c.ongoingType != null) HandleTriggers(new TriggerEvent(TriggerType.afterActualSpell, c)); }
public Minion FindMinion(Minion basis) { if (getMinionAt(basis.position) == basis) return basis; foreach (KeyValuePair<Point, Minion> kv in minions) { if (kv.Value.minionId == basis.minionId) { return kv.Value; } } return null; }
public Minion CreateMinion(MinionType type, bool isEnemy, Point p) { if (!minions.ContainsKey(p)) { Minion spawned = new Minion(type, p, isEnemy); minions[p] = spawned; if (spawned.spells != null) validSpellSets.Add(spawned.spells); return spawned; } return null; }
public void CreateEnemy(MinionType type, Point spawnPoint, MinionAnimationBatch moveAnim) { Minion spawned = new Minion(type, spawnPoint, true); minions[spawnPoint] = spawned; moveAnim.AddAnimation(spawned, spawned.drawPos + new Vector2(32.0f, 0.0f), spawned.drawPos); }
public void ApplyCardEffect(Card c, Minion caster, TriggerItem target, MinionAnimationSequence animation) { TextChanges changes = null; if (cardTextChanges.ContainsKey(c)) changes = cardTextChanges[c]; ApplyEffect(c.effect, new EffectContext(this, changes, caster, target, new TriggerEvent(TriggerType.onSpell, caster, target.permanent), animation)); if (c.ongoingType != null) { Point pos = target.position; ongoingEffects[pos] = new Ongoing(c, pos); } }