public DamageRandomEnemyAction(DamageInfo _info, AttackEffect _effect) { info = _info; SetValues(AbstractDungeon.GetMonsters().GetRandomMonster(true), info); GameActionType = ActionType.Damage; GameAttackEffect = _effect; }
public override void OnEvoke() { AbstractMonster tWeakestMonster = null; for (int i = 0; i < AbstractDungeon.GetMonsters().Monsters.Count; i++) { AbstractMonster tMonster = AbstractDungeon.GetMonsters().Monsters[i]; if (!tMonster.IsDeadOrEscaped()) { if (null == tWeakestMonster) { tWeakestMonster = tMonster; } else if (tMonster.CurrentHealth < tWeakestMonster.CurrentHealth) { tWeakestMonster = tMonster; } } } for (int i = 0; i < AbstractDungeon.GetMonsters().Monsters.Count; i++) { AbstractMonster tMonster = AbstractDungeon.GetMonsters().Monsters[i]; if (tMonster.IsHasPower("Lockon") && !tMonster.IsDeadOrEscaped()) { tWeakestMonster = tMonster; break; } } if (null != tWeakestMonster) { AbstractDungeon.ActionManager.AddToTop(new DamageAction(tWeakestMonster, new DamageInfo(AbstractDungeon.Player, EvokeAmount, DamageType.Thorns), AttackEffect.Fire)); } }
public void AddToTop(AbstractGameAction _action) { if (AbstractDungeon.GetCurrRoom().Phase == RoomPhase.Combat) { Actions.Insert(0, _action); } }
private void triggerPassiveEffect(DamageInfo _info, bool _isHitAll) { AbstractMonster tMonster; if (!_isHitAll) { AbstractCreature tCreature = AbstractDungeon.GetRandomMonster(); for (int i = 0; i < AbstractDungeon.GetMonsters().Monsters.Count; i++) { tMonster = AbstractDungeon.GetMonsters().Monsters[i]; if (tMonster.IsHasPower("Lockon") && !tMonster.IsDeadOrEscaped()) { tCreature = tMonster; break; } } if (null != tCreature) { } AbstractDungeon.ActionManager.AddToBottom(new DamageAction(tCreature, _info, AttackEffect.None, true)); } else { //AbstractDungeon.ActionManager.AddToBottom(new DamageAllEnemiesAction(AbstractDungeon.Player,)); } }
public void AddToBottom(AbstractGameAction _action) { if (AbstractDungeon.GetCurrRoom().Phase == RoomPhase.Combat) { Actions.Add(_action); } }
public void Open(bool _isBossChest) { for (int i = 0; i < AbstractDungeon.Player.Relics.Count; i++) { AbstractDungeon.Player.Relics[i].OnChestOpen(_isBossChest); } if (IsGoldReward) { } if (IsCursed) { } switch (Relic) { case RelicReward.CommonRelic: AbstractDungeon.GetCurrRoom().AddRelicToRewards(RelicTier.Common); break; case RelicReward.UncommonRelic: AbstractDungeon.GetCurrRoom().AddRelicToRewards(RelicTier.Uncommon); break; case RelicReward.RareRelic: AbstractDungeon.GetCurrRoom().AddRelicToRewards(RelicTier.Rare); break; } }
public void AddBlock(int _blockAmount) //获得格挡 { float tValue = _blockAmount; if (IsPlayer) { AbstractRelic tAbstractRelic; for (int i = 0; i < AbstractDungeon.Player.Relics.Count; i++) { tValue = AbstractDungeon.Player.Relics[i].OnPlayerGainedBlock(tValue); } if (tValue > 0f) { for (int i = 0; i < powers.Count; i++) { powers[i].OnGainedBlock(tValue); } } } bool tIsEffect = false; if (CurrentBlock == 0) { tIsEffect = true; } for (int i = 0; i < AbstractDungeon.GetCurrRoom().Monsters.Monsters.Count; i++) { AbstractMonster tMonster = AbstractDungeon.GetCurrRoom().Monsters.Monsters[i]; for (int j = 0; j < tMonster.powers.Count; j++) { tMonster.powers[i].OnPlayerGainedBlock(tValue); } } CurrentBlock += (int)Math.Floor(tValue); if (CurrentBlock >= 99 && IsPlayer) { } if (CurrentBlock > 999) { CurrentHealth = 999; } if (CurrentBlock == 999) { } if (tIsEffect && CurrentBlock > 0) { GainBlockAnimation(); } else if (_blockAmount > 0) { } }
public void EnterCombat() { AbstractDungeon.GetCurrRoom().Phase = RoomPhase.Combat; AbstractDungeon.LastCombatMetricKey = Name; AbstractDungeon.GetCurrRoom().Monsters.Init(); AbstractDungeon.Player.PreBattlePrep(); IsHasFocus = false; }
public void OnExhaust(AbstractCard _card) { if (!AbstractDungeon.GetMonsters().AreMonstersBasicallyDead()) { //flash AbstractDungeon.ActionManager.AddToBottom(new DrawCardAction(Owner, Amount)); } }
public void AtEndOfTurn(bool _isPlayer) { if (!AbstractDungeon.GetMonsters().AreMonstersBasicallyDead()) { //flash AbstractDungeon.ActionManager.AddToBottom(new LoseHPAction(Owner, Owner, hpLoss, AttackEffect.Fire)); AbstractDungeon.ActionManager.AddToBottom(new DamageAllEnemiesAction(null, DamageInfo.CreateDamageMatrix(Amount, true), DamageType.Thorns, AttackEffect.Fire)); } }
public ApplyPowerAction(AbstractCreature _target, AbstractCreature _source, AbstractPower _powerToApply, int _stackAmount, bool _isFast, AttackEffect _attackEffect) { SetValues(_target, _source, _stackAmount); powerToApply = _powerToApply; if (AbstractDungeon.Player.HasRelic("SnakeSkull") && Source != null && Source.IsPlayer && Target != Source && powerToApply.ID.Equals("Poison")) { //AbstractDungeon.Player.GetRelic("SnakeSull").flash(); powerToApply.Amount++; Amount++; } if (powerToApply.ID.Equals("Corruption")) //腐化 { for (int i = 0; i < AbstractDungeon.Player.Hand.Group.Count; i++) { AbstractCard tCard = AbstractDungeon.Player.Hand.Group[i]; if (tCard.Type == CardType.Skill) { tCard.ModifyCostForCombat(-9); } } for (int i = 0; i < AbstractDungeon.Player.DrawPile.Group.Count; i++) { AbstractCard tCard = AbstractDungeon.Player.DrawPile.Group[i]; if (tCard.Type == CardType.Skill) { tCard.ModifyCostForCombat(-9); } } for (int i = 0; i < AbstractDungeon.Player.DiscardPile.Group.Count; i++) { AbstractCard tCard = AbstractDungeon.Player.DiscardPile.Group[i]; if (tCard.Type == CardType.Skill) { tCard.ModifyCostForCombat(-9); } } for (int i = 0; i < AbstractDungeon.Player.ExhaustPile.Group.Count; i++) { AbstractCard tCard = AbstractDungeon.Player.ExhaustPile.Group[i]; if (tCard.Type == CardType.Skill) { tCard.ModifyCostForCombat(-9); } } } GameActionType = ActionType.Power; GameAttackEffect = _attackEffect; if (AbstractDungeon.GetMonsters().AreMonstersBasicallyDead()) { IsDone = true; } }
public static int[] CreateDamageMatrix(int _baseDamage, bool _isPureDamage) { int[] tRetVal = new int[AbstractDungeon.GetMonsters().Monsters.Count]; for (int i = 0; i < tRetVal.Length; i++) { DamageInfo tDamageInfo = new DamageInfo(AbstractDungeon.Player, _baseDamage); if (!_isPureDamage) { tDamageInfo.ApplyEnemyPowersOnly(AbstractDungeon.GetMonsters().Monsters[i]); } tRetVal[i] = tDamageInfo.Output; } return(tRetVal); }
public void RefreshHandLayout() { if (AbstractDungeon.GetCurrRoom().Monsters == null || !AbstractDungeon.GetCurrRoom().Monsters.AreMonstersBasicallyDead()) { AbstractOrb tOrb; for (int i = 0; i < AbstractDungeon.Player.Orbs.Count; i++) { tOrb = AbstractDungeon.Player.Orbs[i]; tOrb.HideEvokeValues(); } for (int i = 0; i < AbstractDungeon.Player.Relics.Count; i++) { AbstractDungeon.Player.Relics[i].OnRefreshHand(); } } }
public void DoUse() { for (int i = 0; i < Target.powers.Count; i++) { if (Target.powers[i].ID.Equals(powerId)) { if (Amount < Target.powers[i].Amount) { Target.powers[i].ReducePower(Amount); Target.powers[i].UpdateDescription(); AbstractDungeon.OnModifyPower(); } else { AbstractDungeon.ActionManager.AddToTop(new RemoveSpecificPowerAction(Target, Source, powerId)); } break; } } }
public void Die(bool _isTriggerRelics) { if (!IsDying) { IsDying = true; if (CurrentHealth <= 0) { for (int i = 0; i < powers.Count; i++) { powers[i].OnDeath(); } } if (_isTriggerRelics) { for (int i = 0; i < AbstractDungeon.Player.Relics.Count; i++) { AbstractDungeon.Player.Relics[i].OnMonsterDeath(this); } } if (AbstractDungeon.GetMonsters().AreMonstersBasicallyDead()) { //AbstractDungeon.OverLayMenu for (int i = 0; i < AbstractDungeon.Player.Limbo.Group.Count; i++) { AbstractDungeon.EffectList.Add(new ExhaustCardEffect(AbstractDungeon.Player.Limbo.Group[i])); } AbstractDungeon.Player.Limbo.Group.Clear(); } if (CurrentHealth < 0) { CurrentHealth = 0; } } }
private void applyGoldBonus(bool _isTheft) { int tGoldAmt = GoldAmount; BonusGold = 0; if (_isTheft) { TextStr = GoldAmount + Text[0]; } else { if (!(AbstractDungeon.GetCurrRoom() is TreasureRoom)) { if (AbstractDungeon.Player.HasRelic("GoldenIdol")) { BonusGold += (int)Mathf.Round(tGoldAmt * 0.25f); } } if (BonusGold == 0) { } } }
public void DoUse() { if (Target.IsDeadOrEscaped()) { IsDone = true; return; } for (int i = 0; i < Target.powers.Count; i++) { if (Target.powers[i].ID.Equals(powerToRemove)) { isPowerExists = true; powerLocation = i; } } if (isPowerExists && Target.powers.Count != 0) { Target.powers[powerLocation].OnRemove(); Target.powers.RemoveAt(powerLocation); AbstractDungeon.OnModifyPower(); } }
public override void Damage(DamageInfo _info) { if (_info.Output > 0 && IsHasPower("IntangiblePlayer")) { _info.Output = 1; } int tDamageAmount = _info.Output; if (!IsDying && !IsEscaping) { if (tDamageAmount < 0) { tDamageAmount = 0; } bool isHadBlock = true; if (CurrentBlock == 0) { isHadBlock = false; } bool tWeakenedToZero = tDamageAmount == 0; tDamageAmount = DecrementBlock(_info, tDamageAmount); if (_info.Owner is AbstractPlayer) { for (int i = 0; i < AbstractDungeon.Player.Relics.Count; i++) { AbstractDungeon.Player.Relics[i].OnAttack(_info, tDamageAmount, this); } } AbstractPower tAbstractPower; if (null != _info.Owner) { for (int i = 0; i < _info.Owner.powers.Count; i++) { _info.Owner.powers[i].OnAttack(_info, tDamageAmount, this); } } for (int i = 0; i < powers.Count; i++) { tDamageAmount = powers[i].OnAttacked(_info, tDamageAmount); } for (int i = 0; i < AbstractDungeon.Player.Relics.Count; i++) { tDamageAmount = AbstractDungeon.Player.Relics[i].OnAttackedMonster(_info, tDamageAmount); } if (tDamageAmount > 0) { if (_info.Owner != this) { UseStaggerAnimation(); } if (tDamageAmount >= 99 && !CardCrawlGame.IsOverkill) { CardCrawlGame.IsOverkill = true; } CurrentHealth -= tDamageAmount; //AbstractDungeon.EffectList.Add(new Strike); if (CurrentHealth < 0) { CurrentHealth = 0; } } else if (tWeakenedToZero && CurrentBlock == 0) { if (isHadBlock) { //AbstractDungeon.EffectList.Add(new ); } else { AbstractDungeon.EffectList.Add(new StrikeEffect(this, 0, 0, 0)); } } //else if (tAbstractPower) // { // } if (CurrentHealth <= 0) { Die(); if (AbstractDungeon.GetMonsters().AreMonstersBasicallyDead()) { AbstractDungeon.ActionManager.CleanCardQueue(); } } if (CurrentBlock > 0) { LoseBlock(); //AbstractDungeon.EffectList } } }
public bool IsCardPlayable(AbstractMonster _monster) { if ((Target != CardTarget.Enemy && Target != CardTarget.SelfAndEnemy || _monster == null || !_monster.IsDying) && !AbstractDungeon.GetMonsters().AreMonstersBasicallyDead()) { return(true); } else { CantUseMessage = null; return(false); } }
public void CalculateCardDamage(AbstractMonster _monster) { applyPowersToBlock(); AbstractPlayer tPlayer = AbstractDungeon.Player; IsDamageModified = false; if (!IsMultiDamage && null != _monster) { float tValue = BaseDamage; if (this is PerfectStrike) { if (IsUpgraded) { tValue += 3 * PerfectStrike.CountCards(); } else { tValue += 2 * PerfectStrike.CountCards(); } if (BaseDamage != (int)tValue) { IsDamageModified = true; } } AbstractPower tPower; for (int i = 0; i < tPlayer.powers.Count; i++) { tPower = tPlayer.powers[i]; if (this is HeavyBlade && tPlayer is StrengthPower) //(升级后的)重刃计算(5)3倍伤害 { if (IsUpgraded) { tValue = tPower.AtDamageGive(tValue, DamageTypeForTurn); tValue = tPower.AtDamageGive(tValue, DamageTypeForTurn); } tValue = tPower.AtDamageGive(tValue, DamageTypeForTurn); tValue = tPower.AtDamageGive(tValue, DamageTypeForTurn); } tValue = tPower.AtDamageGive(tValue, DamageTypeForTurn); if (BaseDamage != (int)tValue) { IsDamageModified = true; } } if (tValue < 0f) { tValue = 0f; } Damage = (int)Math.Floor(tValue); } else { List <AbstractMonster> tMonster = AbstractDungeon.GetCurrRoom().Monsters.Monsters; float[] tValue = new float[tMonster.Count]; for (int i = 0; i < tValue.Length; i++) { tValue[i] = BaseDamage; } AbstractPower tPower; for (int i = 0; i < tValue.Length; i++) { for (int j = 0; j < tPlayer.powers.Count; j++) { tPower = tPlayer.powers[i]; tValue[i] = tPower.AtDamageGive(tValue[i], DamageTypeForTurn); if (BaseDamage != tValue[i]) { IsDamageModified = true; } } } for (int i = 0; i < tValue.Length; i++) { if (tValue[i] < 0) { tValue[i] = 0; } } MultiDamage = new int[tValue.Length]; for (int i = 0; i < tValue.Length; i++) { MultiDamage[i] = (int)Math.Floor(tValue[i]); } Damage = MultiDamage[0]; } }
public bool CanUse() { return(AbstractDungeon.GetCurrRoom().Monsters != null && !AbstractDungeon.GetCurrRoom().Monsters.AreMonstersBasicallyDead() && !AbstractDungeon.ActionManager.IsTurnHasEnded && AbstractDungeon.GetCurrRoom().Phase == RoomPhase.Combat); }
public static RoomResult Roll() { float tRoll = AbstractDungeon.EventRng.Next(); RoomResult[] tPossibleResults = new RoomResult[100]; for (int i = 0; i < tPossibleResults.Length; i++) { tPossibleResults[i] = RoomResult.Event; } int tEliteSize = Convert.ToInt32(EliteChance * 100f); if (AbstractDungeon.GetCurMapNode().Y < 6) { tEliteSize = 0; } int tMonsterSize = Convert.ToInt32(MonsterChance * 100f); int tShopSize = Convert.ToInt32(ShopChance * 100f); if (AbstractDungeon.GetCurrRoom() is ShopRoom) { tShopSize = 0; } int tTreasureSize = Convert.ToInt32(TreasureChance * 100f); int tFillIndex = 0; int tStartIndex = Math.Min(99, tFillIndex); int tEndIndex = Math.Min(100, tFillIndex + tEliteSize); fillArray(tPossibleResults, tStartIndex, tEndIndex, RoomResult.Monster); tFillIndex += tEliteSize; tStartIndex = Math.Min(99, tFillIndex); tEndIndex = Math.Min(100, tFillIndex + tMonsterSize); fillArray(tPossibleResults, tStartIndex, tEndIndex, RoomResult.Monster); tFillIndex += tMonsterSize; tStartIndex = Math.Min(99, tFillIndex); tEndIndex = Math.Min(100, tFillIndex + tShopSize); fillArray(tPossibleResults, tStartIndex, tEndIndex, RoomResult.Shop); tFillIndex += tShopSize; tStartIndex = Math.Min(99, tFillIndex); tEndIndex = Math.Min(100, tFillIndex + tTreasureSize); fillArray(tPossibleResults, tStartIndex, tEndIndex, RoomResult.Treasure); RoomResult tChoice = tPossibleResults[Convert.ToInt32(tRoll * 100f)]; if (tChoice == RoomResult.Elite) { if (AbstractDungeon.Player.HasRelic("JuzuBracelet")) { //AbstractDungeon.Player.GetRelic("JuzuBracelet").flash(); tChoice = RoomResult.Event; } EliteChance = 0f; } else { EliteChance += 0.02f; } if (tChoice == RoomResult.Monster) { if (AbstractDungeon.Player.HasRelic("JuzuBracelet")) { //AbstractDungeon.Player.GetRelic("JuzuBracelet").flash(); tChoice = RoomResult.Event; } MonsterChance = 0.1f; } else { MonsterChance += 0.1f; } if (tChoice == RoomResult.Shop) { ShopChance = 0.03f; } else { ShopChance += 0.03f; } if (tChoice == RoomResult.Treasure) { if (AbstractDungeon.Player.HasRelic("TinyChest")) { //AbstractDungeon.Player.GetRelic("TinyChest").flash(); TreasureChance = 0.120000005f; } else { TreasureChance = 0.02f; } } else { TreasureChance += 0.02f; } return(tChoice); }
public UseCardAction(AbstractCard _card, AbstractCreature _target) { TargetCreature = _target; IsReboundCard = false; targetCard = _card; if (_card.IsExhaustOnUseOnce || _card.IsExhaust) { IsExhaustCard = true; } SetValues(AbstractDungeon.Player, (AbstractCreature)null, 1); Duration = 0.15f; for (int i = 0; i < AbstractDungeon.Player.powers.Count; i++) { AbstractDungeon.Player.powers[i].OnUseCard(_card, this); } for (int i = 0; i < AbstractDungeon.Player.Relics.Count; i++) { if (!_card.IsNotTriggerOnUse) { AbstractDungeon.Player.Relics[i].OnUseCard(_card, this); } } for (int i = 0; i < AbstractDungeon.Player.Hand.Group.Count; i++) { if (!_card.IsNotTriggerOnUse) { AbstractDungeon.Player.Hand.Group[i].TriggerOnCardPlayed(_card); } } for (int i = 0; i < AbstractDungeon.Player.DiscardPile.Group.Count; i++) { if (!_card.IsNotTriggerOnUse) { AbstractDungeon.Player.DiscardPile.Group[i].TriggerOnCardPlayed(_card); } } for (int i = 0; i < AbstractDungeon.Player.DrawPile.Group.Count; i++) { AbstractCard tCard = AbstractDungeon.Player.DrawPile.Group[i]; if (!_card.IsNotTriggerOnUse) { tCard.TriggerOnCardPlayed(_card); } } for (int i = 0; i < AbstractDungeon.GetCurrRoom().Monsters.Monsters.Count; i++) { AbstractMonster tMonster = AbstractDungeon.GetCurrRoom().Monsters.Monsters[i]; for (int j = 0; j < tMonster.powers.Count; j++) { if (!_card.IsNotTriggerOnUse) { tMonster.powers[i].OnUseCard(_card, this); } } } if (IsExhaustCard) { GameActionType = ActionType.Exhaust; } else { GameActionType = ActionType.Use; } }
public override void OnPlayerEntry() { Chest = AbstractDungeon.GetRandomChest(); }