com.megacrit.cardcrawl.characters.AbstractPlayer Java Examples

The following examples show how to use com.megacrit.cardcrawl.characters.AbstractPlayer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultCommonPower.java    From StS-DefaultModBase with MIT License 6 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(p, p,
            new CommonPower(p, p, magicNumber), magicNumber));
    /*
    Hey do you see this "amount" and "stackAmount" up here^ (press ctrl+p inside the parentheses to see parameters)
    THIS DOES NOT MEAN APPLY 1 POWER 1 TIMES. If you put 2 in both numbers it would apply 2. NOT "2 STACKS, 2 TIMES".

    The stackAmount is for telling ApplyPowerAction what to do if a stack already exists. Which means that it will go
    "ah, I see this power has an ID ("") that matches the power I received. I will therefore instead add the stackAmount value
    to this existing power's amount" (Thank you Johnny)

    Which is why if we want to apply 2 stacks with this card every time, want 2 in both numbers -
    "Always add 2, even if the player already has this power."
    */
}
 
Example #2
Source File: ChainLightning.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    this.currentChainHopIndex = 0;

    getRandomOrderMonsters(AbstractDungeon.getMonsters().monsters, m)
            .forEach(monster -> {
                this.calculateCardDamage(monster);
                AbstractDungeon.actionManager.addToBottom(new DamageAction(
                        monster,
                        new DamageInfo(p, this.damage, DamageInfo.DamageType.NORMAL),
                        AttackEffect.NONE));
                addLightningEffect(monster, this.currentChainHopIndex);
                this.currentChainHopIndex += 1;
            });

    this.currentChainHopIndex = 0;
}
 
Example #3
Source File: ForceRippleOld.java    From FruityMod-StS with MIT License 6 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    AbstractDungeon.actionManager.addToBottom(new com.megacrit.cardcrawl.actions.common.DamageAction(m,
            new DamageInfo(p, this.damage, this.damageTypeForTurn),
            AbstractGameAction.AttackEffect.SLASH_DIAGONAL));

    ArrayList<AbstractCard> nonEtherialCards = new ArrayList<AbstractCard>();

    for (AbstractCard card : p.hand.group) {
        if (card.isEthereal || card == this) continue;
        nonEtherialCards.add(card);
    }

    if (nonEtherialCards.size() > 0) {
        AbstractDungeon.actionManager.addToBottom(new ShuffleCardsToDrawPileAction(p, p, nonEtherialCards, true, true));
    }

}
 
Example #4
Source File: Anxiety.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster abstractMonster) {
    addToBot(new DrawCardAction(this.misc));
    addToBot(new GainEnergyAction(this.urMagicNumber));
    if (this.misc > 0) {
        this.addToBot(new IncreaseMiscAction(this.uuid, this.misc, -this.magicNumber));
    }
}
 
Example #5
Source File: OnAfterPlayerHpLossSubscriberPatch.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@SpireInsertPatch(
        locator = Locator.class,
        localvars = { "damageAmount" }
)
public static void patch(AbstractPlayer __this, DamageInfo info, int damageAmount)
{
    if (__this instanceof OnAfterPlayerHpLossSubscriber) {
        if (damageAmount > 0) {
            ((OnAfterPlayerHpLossSubscriber)__this).onAfterPlayerHpLoss(damageAmount);
        }
    }
}
 
Example #6
Source File: DefaultAttackWithVariable.java    From StS-DefaultModBase with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    // Create an int which equals to your current energy.
    int effect = EnergyPanel.totalCount;

    // For each energy, create 1 damage action.
    for (int i = 0; i < effect; i++) {
        AbstractDungeon.actionManager.addToBottom(
                new DamageAction(m, new DamageInfo(p, damage, damageTypeForTurn),
                        AbstractGameAction.AttackEffect.FIRE));
    }
}
 
Example #7
Source File: Channel.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    addToBot(new GainBlockAction(p, p, block));
    addToBot(new ApplyPowerAction(p, p, new EnergizedCustomPower(p, magicNumber)));
    if (metaMagicNumber > 0) {
        addToBot(new CardsToTopOfDeckAction(p, p.discardPile, this.metaMagicNumber, false));
    }
}
 
Example #8
Source File: WastingForm.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    for (int i = 0; i < metaMagicNumber; i++) {
        AbstractCard c = AbstractDungeon.returnRandomCurse();
        AbstractDungeon.actionManager.addToBottom(new MakeTempCardInDiscardAction(c, 1));
    }
    addToBot(new ApplyPowerAction(p, p, new WastingFormPower(p, magicNumber, metaMagicNumber)));
}
 
Example #9
Source File: Vortex.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    int draw = 10 - AbstractDungeon.player.hand.size();
    if (draw > 0) {
        AbstractDungeon.actionManager.addToTop(new DrawCardAction(p, draw));
        AbstractDungeon.actionManager.addToBottom(new MakeTempCardInDrawPileAction(new Dazed(), 4, false, false));
    }
}
 
Example #10
Source File: DefaultRareAttack.java    From StS-DefaultModBase with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    if (m != null) {
        AbstractDungeon.actionManager.addToBottom(new VFXAction(new WeightyImpactEffect(m.hb.cX, m.hb.cY)));
    }
    AbstractDungeon.actionManager.addToBottom(
            new DamageAction(m, new DamageInfo(p, damage, damageTypeForTurn),
                    AbstractGameAction.AttackEffect.NONE));

}
 
Example #11
Source File: PurgeMind.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public int calculateBonusMagicNumber() {
    AbstractPlayer p = AbstractDungeon.player;
    return countRememberCardsInGroup(p.hand) +
            countRememberCardsInGroup(p.drawPile) +
            countRememberCardsInGroup(p.discardPile) +
            countRememberCardsInGroup(p.exhaustPile);
}
 
Example #12
Source File: OnDamageToRedirectPatch.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@SpirePrefixPatch
public static SpireReturn patch(AbstractPlayer __this, DamageInfo info) {
    for (AbstractPower p : __this.powers) {
        if (p instanceof OnDamageToRedirectSubscriber) {
            if (((OnDamageToRedirectSubscriber)p).onDamageToRedirect(__this, info, DEFAULT_ATTACK_EFFECT)) {
                return SpireReturn.Return(null);
            }
        }
    }
    return SpireReturn.Continue();
}
 
Example #13
Source File: ChatteringStrike.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    addToBot(new DamageAction(m, new DamageInfo(p, damage), AttackEffect.BLUNT_LIGHT));

    // Note: this avoids the extra copy generating another extra copy itself, but it also avoids copies from Gather
    // Power or Quicksilver generating additional extra copies (they're intended to only do one copy per stack)
    if (!this.purgeOnUse) {
        for (int i = 0; i < magicNumber; ++i) {
            CardMetaUtils.playCardAdditionalTime(this, m);
        }
    }
}
 
Example #14
Source File: PlasmaWave.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public float calculateModifiedCardDamage(AbstractPlayer player, AbstractMonster monster, float tmp) {
    if (monster != null) {
        if (monster.hasPower("Vulnerable")) {
            return tmp * 2;
        }
    }
    return tmp;
}
 
Example #15
Source File: JorbsModSettings.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
private static void unlockA20(AbstractPlayer.PlayerClass clz) {
    Prefs prefs = CardCrawlGame.characterManager.getCharacter(clz).getPrefs();
    if (prefs.getInteger(CharStat.WIN_COUNT, 0) == 0) {
        prefs.putInteger(CharStat.WIN_COUNT, 1);
    }
    prefs.putInteger(CharStat.LAST_ASCENSION_LEVEL, Settings.MAX_ASCENSION_LEVEL);
    prefs.putInteger(CharStat.ASCENSION_LEVEL, Settings.MAX_ASCENSION_LEVEL);
    prefs.flush();
}
 
Example #16
Source File: DeterminationAction.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void update() {
    if (target.hasPower(FragilePower.POWER_ID)) {
        FragilePower fragilePower = (FragilePower) target.getPower(FragilePower.POWER_ID);
        fragilePower.forceSnapTurn();
    } else if (target.hasPower(SnappedPower.POWER_ID)) {
        target.getPower(SnappedPower.POWER_ID).flash();
    } else if (!target.hasPower(FragilePower.POWER_ID) && !target.hasPower(SnappedPower.POWER_ID)) {
        SnapCounter snapCounter = new SnapCounter((AbstractPlayer) target);
        snapCounter.forceSnapTurn();
        addToTop(new ApplyPowerAction(target, target, new FragilePower(target, snapCounter), amount));
    }
    isDone = true;
}
 
Example #17
Source File: WrathMemory.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
public static void permanentlyIncreaseCardDamage(AbstractCard card) {
    AbstractPlayer p = AbstractDungeon.player;
    String logPrefix = "Wrath: permanentlyIncreaseCardDamage: " + card.cardID + " (" + card.uuid + "): ";

    if (!isUpgradeCandidate(card)) {
        JorbsMod.logger.error(logPrefix + "attempting to upgrade non-upgrade-candidate?");
        return;
    }

    JorbsMod.logger.info(logPrefix + "Increasing baseDamage by " + DAMAGE_INCREASE_PER_KILL + " from " + card.baseDamage);

    AbstractCard cardToShowForVfx = card;
    AbstractCard masterCard = StSLib.getMasterDeckEquivalent(card);
    if (masterCard != null) {
        masterCard.baseDamage += DAMAGE_INCREASE_PER_KILL;
        if (usesMiscToTrackPermanentBaseDamage(masterCard)) {
            masterCard.misc += DAMAGE_INCREASE_PER_KILL;
        }
        WrathField.wrathEffectCount.set(masterCard, WrathField.wrathEffectCount.get(masterCard) + 1);
        masterCard.superFlash();
        cardToShowForVfx = masterCard;
    }

    for (AbstractCard instance : GetAllInBattleInstances.get(card.uuid)) {
        instance.baseDamage += DAMAGE_INCREASE_PER_KILL;
        if (usesMiscToTrackPermanentBaseDamage(instance)) {
            instance.misc += DAMAGE_INCREASE_PER_KILL;
        }
        WrathField.wrathEffectCount.set(instance, WrathField.wrathEffectCount.get(instance) + 1);
        instance.applyPowers();
    }

    EffectUtils.addWrathCardUpgradeEffect(cardToShowForVfx);
}
 
Example #18
Source File: DefaultSecondMagicNumberSkill.java    From StS-DefaultModBase with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    AbstractDungeon.actionManager.addToBottom(
            new ApplyPowerAction(m, p, new VulnerablePower(m, magicNumber, false), this.magicNumber));

    AbstractDungeon.actionManager.addToBottom(
            new ApplyPowerAction(m, p, new PoisonPower(m, p, this.defaultSecondMagicNumber), this.defaultSecondMagicNumber));

}
 
Example #19
Source File: OldPocket.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    // Based on HandOfGreed's GreedAction
    for(int i = 0; i < magicNumber; ++i) {
        AbstractDungeon.effectList.add(new GainPennyEffect(p, p.hb.cX, p.hb.cY, p.hb.cX, p.hb.cY, true));
    }
    AbstractDungeon.player.gainGold(magicNumber);

    addToBot(new RememberSpecificMemoryAction(p, CharityMemory.STATIC.ID));
    if (upgraded) {
        addToBot(new GainClarityOfCurrentMemoryAction(p));
    }
}
 
Example #20
Source File: Fear.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    if (m.type == EnemyType.BOSS) {
        AbstractDungeon.effectList.add(new ThoughtBubble(AbstractDungeon.player.dialogX, AbstractDungeon.player.dialogY, 3.0F, EXTENDED_DESCRIPTION[0], true));
    } else {
        addToBot(new ApplyPowerAction(m, p, new FearPower(m, magicNumber), magicNumber));
    }
}
 
Example #21
Source File: Thorns.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    addToBot(new RememberSpecificMemoryAction(p, HumilityMemory.STATIC.ID));
    if (upgraded) {
        addToBot(new GainClarityOfCurrentMemoryAction(p));
    } else {
        addToBot(new IfEnemyIntendsToAttackAction(new GainClarityOfCurrentMemoryAction(p)));
    }
}
 
Example #22
Source File: ColorSpray.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster monster) {
    addToBot(new DamageAllEnemiesAction(p, multiDamage, damageTypeForTurn, AttackEffect.FIRE));

    for(AbstractMonster m : AbstractDungeon.getCurrRoom().monsters.monsters) {
        final AbstractPower randomDebuff = generateRandomDebuff(p, m);
        AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(m, p, randomDebuff, randomDebuff.amount, true, AttackEffect.NONE));
    }

    addToBot(new RememberSpecificMemoryAction(p, EnvyMemory.STATIC.ID));
}
 
Example #23
Source File: Entropy.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(m, p,
            new com.megacrit.cardcrawl.powers.StrengthPower(m, -1 * this.magicNumber), -1 * this.magicNumber));
    if (!m.hasPower("Artifact")) {
        AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(m, p,
                new com.megacrit.cardcrawl.powers.LoseStrengthPower(m, -1 * this.magicNumber), -1 * this.magicNumber));
    }
}
 
Example #24
Source File: FranticMind.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster abstractMonster) {
    if (magicNumber > 0) {
        addToBot(new DiscardAction(p, p, magicNumber, false));
        addToBot(new DrawCardAction(magicNumber));
    }
}
 
Example #25
Source File: Hurt.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    addToBot(new DamageAction(m, new DamageInfo(p, damage), AttackEffect.SLASH_HEAVY));

    if (magicNumber > 0) {
        addToBot(new DamageAction(p, new DamageInfo(p, magicNumber, DamageInfo.DamageType.HP_LOSS), AttackEffect.SHIELD));
    }
}
 
Example #26
Source File: Vortex.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public boolean canUse(AbstractPlayer p, AbstractMonster m) {
    if (!super.canUse(p, m)) {
        return false;
    }
    if (m != null && (m.hasPower("Weakened") || m.hasPower("Vulnerable"))) {
        return true;
    }
    this.cantUseMessage = cardStrings.EXTENDED_DESCRIPTION[0];
    return false;
}
 
Example #27
Source File: AlwaysRetainPatch.java    From StSLib with MIT License 5 votes vote down vote up
@SpireInsertPatch(
        locator=Locator.class,
        localvars={"c"}
)
public static void Insert(AbstractPlayer __instance, AbstractCard c)
{
    if (c != null && AlwaysRetainField.alwaysRetain.get(c)) {
        c.retain = true;
    }
}
 
Example #28
Source File: StrokeOfGenius.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void optionSelected(AbstractPlayer p, AbstractMonster m, int i) {
    CardType type;
    switch (i) {
        case 0:
            type = CardType.ATTACK;
            break;
        case 1:
            type = CardType.SKILL;
            break;
        case 2:
            type = CardType.POWER;
            break;
        default:
            return;
    }

    AbstractCard c;
    if (type == CardType.ATTACK) {
        c = AbstractDungeon.returnTrulyRandomCardInCombat(CardType.ATTACK).makeCopy();
    } else if (type == CardType.SKILL) {
        c = AbstractDungeon.returnTrulyRandomCardInCombat(CardType.SKILL).makeCopy();
    } else {
        c = AbstractDungeon.returnTrulyRandomCardInCombat(CardType.POWER).makeCopy();
    }
    AbstractDungeon.actionManager.addToBottom(new MakeTempCardInHandAction(c, true));
    c.setCostForTurn(0);
}
 
Example #29
Source File: MirrorPower.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public boolean onDamageToRedirect(AbstractPlayer player, DamageInfo info, AbstractGameAction.AttackEffect attackEffect) {
    if (info.type != DamageInfo.DamageType.THORNS && info.type != DamageInfo.DamageType.HP_LOSS && info.owner != null && info.owner != this.owner) {
        this.flash();
        this.addToTop(new DamageAction(info.owner, new DamageInfo(this.owner, info.output, DamageInfo.DamageType.THORNS), attackEffect, false));
        return true;
    }
    return false;
}
 
Example #30
Source File: Retrograde.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    AbstractDungeon.actionManager.addToBottom(new DamageAction((AbstractCreature) m,
            new DamageInfo(p, this.damage, this.damageTypeForTurn), AbstractGameAction.AttackEffect.BLUNT_LIGHT));
    AbstractDungeon.actionManager.addToBottom(new DamageAction((AbstractCreature) m,
            new DamageInfo(p, this.damage, this.damageTypeForTurn), AbstractGameAction.AttackEffect.BLUNT_HEAVY));
}