Java Code Examples for com.megacrit.cardcrawl.dungeons.AbstractDungeon#player()

The following examples show how to use com.megacrit.cardcrawl.dungeons.AbstractDungeon#player() . 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: VoiceoverMaster.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
private static VoiceoverInfo getSfxByKey(String key) {
    if (AbstractDungeon.player == null) {
        return null;
    }
    if (!sfxByCharacterAndKey.containsKey(AbstractDungeon.player.chosenClass)) {
        return null;
    }
    Map<String, List<VoiceoverInfo>> sfxByKey = sfxByCharacterAndKey.get(AbstractDungeon.player.chosenClass);
    if (!sfxByKey.containsKey(key)) {
        return null;
    }
    List<VoiceoverInfo> candidates = sfxByKey.get(key);
    if (candidates.isEmpty()) {
        return null;
    }
    int index = MathUtils.random(candidates.size() - 1);
    return candidates.get(index);
}
 
Example 2
Source File: CardUpgradeGlowCheckPatch.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@SpirePostfixPatch
public static void patch(AbstractCard __this)
{
    if (AbstractDungeon.player != null && AbstractDungeon.player.hand != null && CombatUtils.isInCombat())
    {
        AbstractDungeon.player.hand.glowCheck();
    }
}
 
Example 3
Source File: MageArmor.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public int onPlayerHpLossWhileInHand(int hpLoss) {
    int newHpLoss = hpLoss - magicNumber;
    if (newHpLoss < 0) {
        newHpLoss = 0;
    }
    if (hpLoss - newHpLoss > 0) {
        AbstractPlayer p = AbstractDungeon.player;
        AbstractDungeon.effectList.add(new BlockedWordEffect(p, p.hb.cX, p.hb.cY, EXTENDED_DESCRIPTION[1]));
        // addToTop is to handle multi-attacks correctly
        addToTop(new DiscardSpecificCardAction(this));
    }
    return newHpLoss;
}
 
Example 4
Source File: MemoryHooksPatch.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@SpirePrefixPatch
public static void Prefix(AbstractMonster __this) {
    // halfDead is for cases like darklings or awakened one; all "on monster death" memory effects want to ignore those cases.
    // isSuiciding is for effects like Transient/Exploder/SnakeDagger/slime splits (the player isn't "killing", so they don't count)
    if (!__this.halfDead && !MonsterSuicideTrackingPatch.IsMonsterSuicidingField.isSuiciding.get(__this) && !IsMonsterFriendlyField.isFriendly.get(__this)) {
        AbstractPlayer player = AbstractDungeon.player;
        MemoryManager memoryManager = MemoryManager.forPlayer(player);
        if (memoryManager != null) {
            forEachMemory(player, m -> m.onMonsterKilled(__this));
        }
    }
}
 
Example 5
Source File: ManifestPatch.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@SpirePostfixPatch
public static boolean patch(boolean originalResult, MapRoomNode __this, MapRoomNode __node)
{
    if (AbstractDungeon.player == null) {
        return originalResult;
    }

    int manifest = PlayerManifestField.manifestField.get(AbstractDungeon.player);

    if (manifest == 0 && !(AbstractDungeon.player instanceof Cull)) {
        return originalResult;
    }

    int startingY = __this.y;
    int targetY = startingY + 1 + manifest;
    // Mapping has special handling for the first floor of each act that breaks if they're ever considered connected-to
    if (__node.y == 0) {
        return false;
    }
    // Don't skip mid-act treasure chests
    if (startingY < 8 && targetY > 8) {
        targetY = 8;
    }
    // Don't skip boss fires
    else if (startingY < 14 && targetY > 14) {
        targetY = 14;
    }
    // Don't skip bosses
    else if (startingY < 15 && targetY > 15) {
        targetY = 15;
    }

    return __node.y == targetY;
}
 
Example 6
Source File: ManifestPatch.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@SpireInsertPatch(locator = IncrementFloorClimbedLocator.class)
public static void updateFloorNumPatch(AbstractDungeon __this, SaveFile saveFile) {
    if (AbstractDungeon.player != null) {
        __this.floorNum += PlayerManifestField.manifestField.get(AbstractDungeon.player);

        boolean nextRoomIsEvent = __this.nextRoom != null && __this.nextRoom.room instanceof EventRoom;
        int startingManifest = (nextRoomIsEvent && AbstractDungeon.player instanceof Cull) ? 1 : 0;
        PlayerManifestField.manifestField.set(AbstractDungeon.player, startingManifest);
    }
}
 
Example 7
Source File: CampfireThirstPatch.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
public static AbstractCampfireOption getCullCampfireOption(AbstractCampfireOption originalOption) {
    if(AbstractDungeon.player instanceof Cull) {
        return new ThirstOption(getWrathCards().size() > 0);
    } else {
        return originalOption;
    }
}
 
Example 8
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 9
Source File: Dazed_P.java    From FruityMod-StS with MIT License 5 votes vote down vote up
private void updateEnigmaValue() {
    AbstractPlayer p = AbstractDungeon.player;
    if (p != null) {
        int enigmaAmount = p.getPower("EnigmaPower").amount;
        if (this.baseBlock != enigmaAmount || this.baseDamage != enigmaAmount) {
            this.baseBlock = enigmaAmount;
            this.baseDamage = enigmaAmount;
            this.initializeDescription();
        }
    }
}
 
Example 10
Source File: IlluminateAction.java    From FruityMod-StS with MIT License 5 votes vote down vote up
public IlluminateAction(AbstractCreature source, boolean upgraded) {
    this.setValues(AbstractDungeon.player, source, amount);
    this.actionType = AbstractGameAction.ActionType.DRAW;
    this.duration = 0.25f;
    this.p = AbstractDungeon.player;
    this.freedupe = upgraded;
}
 
Example 11
Source File: EclipsePower.java    From FruityMod-StS with MIT License 5 votes vote down vote up
public EclipsePower(int magic) {
    name = NAME;
    ID = POWER_ID;
    this.amount = magic;
    this.owner = AbstractDungeon.player;
    type = PowerType.BUFF;
    this.img = new Texture(SeekerMod.makePowerImagePath(ChaosFormPower.POWER_ID));
    updateDescription();
}
 
Example 12
Source File: Voiceover.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
public Voiceover(Sfx sfx, String subtitle, float startingDelay, float dampeningDuration) {
    this.sfx = sfx;
    this.source = AbstractDungeon.player;
    this.subtitle = subtitle;
    this.dampeningDuration = dampeningDuration;

    if (startingDelay > 0.0F) {
        this.duration = startingDelay;
        this.state = State.INITIAL_DELAY;
    } else {
        this.duration = dampeningDuration;
        this.state = State.DAMPENING_MASTER_VOLUME;
    }
}
 
Example 13
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 14
Source File: GrimDirge.java    From jorbs-spire-mod with MIT License 4 votes vote down vote up
@Override
public void onCardEntombed() {
    AbstractPower grimDirgePower = new EntombedGrimDirgePower(AbstractDungeon.player, this, EXHUME_TURN);
    grimDirgePowerInstanceID = grimDirgePower.ID;
    addToTop(new ApplyPowerAction(AbstractDungeon.player, AbstractDungeon.player, grimDirgePower));
}
 
Example 15
Source File: EtherealizeAction.java    From FruityMod-StS with MIT License 4 votes vote down vote up
public EtherealizeAction() {
    this.actionType = AbstractGameAction.ActionType.CARD_MANIPULATION;
    this.p = AbstractDungeon.player;
}
 
Example 16
Source File: Withering.java    From jorbs-spire-mod with MIT License 4 votes vote down vote up
@Override
public void onDraw() {
    AbstractPlayer p = AbstractDungeon.player;
    addToBot(new ApplyPowerAction(p, p, new WitheringPower(p, metaMagicNumber)));
}
 
Example 17
Source File: ConvergenceAction.java    From FruityMod-StS with MIT License 4 votes vote down vote up
public ConvergenceAction(boolean upgraded) {
    this.actionType = AbstractGameAction.ActionType.CARD_MANIPULATION;
    this.p = AbstractDungeon.player;
    this.duration = Settings.ACTION_DUR_FAST;
    this.upgraded = upgraded;
}
 
Example 18
Source File: GremlinMatchPatch.java    From FruityMod-StS with MIT License 4 votes vote down vote up
@SpireInsertPatch(rloc = 32, localvars = {"retVal"})
public static void Insert(Object __obj_instance, ArrayList<AbstractCard> retVal) {
    if (AbstractDungeon.player instanceof TheSeeker) {
        retVal.add(new AstralHaze());
    }
}
 
Example 19
Source File: TelescopeAction.java    From FruityMod-StS with MIT License 4 votes vote down vote up
public TelescopeAction() {
    this.p = AbstractDungeon.player;
    this.duration = Settings.ACTION_DUR_MED;
    this.actionType = AbstractGameAction.ActionType.CARD_MANIPULATION;
}
 
Example 20
Source File: OnResetPlayerSubscriberPatch.java    From jorbs-spire-mod with MIT License 4 votes vote down vote up
@SpirePostfixPatch
public static void patch() {
    if (AbstractDungeon.player instanceof OnResetPlayerSubscriber) {
        ((OnResetPlayerSubscriber) AbstractDungeon.player).onResetPlayer();
    }
}