Java Code Examples for com.megacrit.cardcrawl.characters.AbstractPlayer#hasPower()

The following examples show how to use com.megacrit.cardcrawl.characters.AbstractPlayer#hasPower() . 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: WitheringPatch.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 __instance, DamageInfo info, @ByRef int[] damageAmount) {
    AbstractPower maybeWithering = __instance.getPower(WitheringPower.POWER_ID);
    if(__instance.hasPower(IntangiblePlayerPower.POWER_ID) && maybeWithering != null)
    {
        damageAmount[0] = Math.min(maybeWithering.amount + 1, info.output);
    }
}
 
Example 2
Source File: ForcedPresence.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster abstractMonster) {
    if (p.hasPower(IntangiblePlayerPower.POWER_ID) && p.getPower(IntangiblePlayerPower.POWER_ID).amount > 0) {
        AbstractPower power = p.getPower(IntangiblePlayerPower.POWER_ID);
        if (power.amount == 1) {
            this.addToBot(new RemoveSpecificPowerAction(p, p, power));
        } else {
            this.addToBot(new ReducePowerAction(p, p, power, magicNumber));
        }

        addToBot(new GainEnergyAction(urMagicNumber));
    }
}
 
Example 3
Source File: RefundExhaustivePatch.java    From StSLib with MIT License 5 votes vote down vote up
public static void Postfix(AbstractPlayer p, AbstractCard c, AbstractMonster monster, int energyOnUse)
{
    if (RefundFields.refund.get(c) > 0) {
        if (!c.freeToPlayOnce
                && ((c.costForTurn == -1 && energyOnUse > 0) || c.costForTurn > 0
                && (!p.hasPower(Corruption.ID)
                || c.type != AbstractCard.CardType.SKILL))) {
            AbstractDungeon.actionManager.addToBottom(new RefundAction(c, RefundFields.refund.get(c), energyOnUse));
        }
    }
}
 
Example 4
Source File: SeekerMod.java    From FruityMod-StS with MIT License 5 votes vote down vote up
private boolean moreThanXStacks(AbstractPlayer player, String powerID, int stacksWanted) {
    if (player != null && player.hasPower(powerID) && player.getPower(powerID).amount >= stacksWanted) {
        return true;
    } else {
        return false;
    }
}
 
Example 5
Source File: SeekerMod.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void receiveCardUsed(AbstractCard c) {
    AbstractPlayer p = AbstractDungeon.player;
    if (p.hasPower("EnigmaPower") && c.cardID.equals("Dazed")) {
        AbstractDungeon.actionManager.addToTop(new GainBlockAction(p, p, c.block));
        AbstractDungeon.actionManager.addToTop(new DamageAllEnemiesAction(AbstractDungeon.player,
                c.multiDamage,
                DamageInfo.DamageType.NORMAL, AbstractGameAction.AttackEffect.FIRE, true));
        c.exhaustOnUseOnce = false;
    }
}
 
Example 6
Source File: Umbra.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    if (p.hasPower(VulnerablePower.POWER_ID) || p.hasPower(FrailPower.POWER_ID)) {
        addToBot(new GainBlockAction(p, block));
    }
    if (p.hasPower(WeakPower.POWER_ID)) {
        addToBot(new DamageAction(m, new DamageInfo(p, damage, damageTypeForTurn), AbstractGameAction.AttackEffect.FIRE));
    }
}
 
Example 7
Source File: Dazed_P.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void applyPowers() {
    AbstractPlayer p = AbstractDungeon.player;
    if (p.hasPower("EnigmaPower")) {
        super.applyPowers();
        updateEnigmaValue();
    }
}
 
Example 8
Source File: PlayableCursesPatch.java    From jorbs-spire-mod with MIT License 4 votes vote down vote up
public static boolean hasCatharsisPower(AbstractPlayer p) {
    return p.hasPower(CatharsisPower.POWER_ID);
}
 
Example 9
Source File: ForcedPresence.java    From jorbs-spire-mod with MIT License 4 votes vote down vote up
@Override
public boolean shouldGlowGold() {
    AbstractPlayer p = AbstractDungeon.player;
    return (p.hasPower(IntangiblePlayerPower.POWER_ID) && p.getPower(IntangiblePlayerPower.POWER_ID).amount > 0);
}