Advertisement
Guest User

Untitled

a guest
Apr 25th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 7.13 KB | None | 0 0
  1. import com.megacrit.cardcrawl.actions.common.ApplyPowerAction;
  2. import com.megacrit.cardcrawl.cards.AbstractCard;
  3. import com.megacrit.cardcrawl.characters.AbstractPlayer;
  4. import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
  5. import com.megacrit.cardcrawl.monsters.AbstractMonster;
  6. import com.megacrit.cardcrawl.powers.AbstractPower;
  7.  
  8. import basemod.abstracts.CustomCard;
  9.  
  10. import java.util.ArrayList;
  11. import java.util.Iterator;
  12.  
  13. public class SpellcraftCard
  14.         extends CustomCard {
  15.     public static final String ID = "Spellcraft";
  16.     public static final String NAME = "Spellcraft";
  17.     public static final String DESCRIPTION = "Play all cards from the Spellcraft-Pool. NL Other Skills this turn exhaust. Add Skills exhausted that way to the Spellcraft-Pool.";
  18.     public static final String IMG_PATH = "img/my_card_img.png";
  19.     private static final int COST = 2;
  20.     private static final int POOL = 1;
  21.  
  22.     public SpellcraftCard() {
  23.         super(ID, NAME, IMG_PATH, COST, DESCRIPTION,
  24.                 AbstractCard.CardType.ATTACK, CardColor.COLORLESS,
  25.                 AbstractCard.CardRarity.UNCOMMON, CardTarget.SELF, POOL);
  26.  
  27.         this.setBackgroundTexture("img/custom_background_small.png", "img/custom_background_large.png");
  28.  
  29.         this.setOrbTexture("img/custom_orb_small.png", "img/custom_orb_large.png");
  30.  
  31.         this.setBannerTexture("img/custom_banner_large.png", "img/custom_banner_large.png");
  32.     }
  33.  
  34.     @Override
  35.     public void use(AbstractPlayer p, AbstractMonster m) {
  36.         boolean powerExists = false;
  37.         Iterator var4 = p.powers.iterator();
  38.         while (var4.hasNext()) {
  39.             AbstractPower pow = (AbstractPower) var4.next();
  40.             if (pow.ID.equals("SpellCraftPowerCast")) {
  41.                 ArrayList<AbstractCard> CastList = ((SpellcraftPowerCast)pow).getCast();
  42.                 for (AbstractCard card : CastList)
  43.                 {
  44.                     powerExists = true;
  45.                     card.use(p, AbstractDungeon.getRandomMonster());
  46.                 }
  47.             }
  48.         }
  49.         if (!powerExists){
  50.             AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(p, p, new SpellcraftPowerCast(p)));
  51.         }
  52.         while (var4.hasNext()) {
  53.             AbstractPower pow = (AbstractPower) var4.next();
  54.             if (pow.ID.equals("SpellCraftPowerExhaust")) {
  55.                 ArrayList<AbstractCard> CastList = ((SpellcraftPowerCast)pow).getCast();
  56.                 for (AbstractCard card : CastList)
  57.                 {
  58.                     powerExists = true;
  59.                 }
  60.             }
  61.         }
  62.         if (!powerExists){
  63.             AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(p, p, new SpellcraftPowerExhaust(p)));
  64.         }
  65.     }
  66.  
  67.     @Override
  68.     public AbstractCard makeCopy(){
  69.         return new SpellcraftCard();
  70.     }
  71.  
  72.     @Override
  73.     public void upgrade() {
  74.         if (!this.upgraded) {
  75.         }
  76.     }
  77. }
  78. _______________________________________________________________________________________________________________________________________
  79. //
  80. // Source code recreated from a .class file by IntelliJ IDEA
  81. // (powered by Fernflower decompiler)
  82. //
  83. import com.megacrit.cardcrawl.actions.common.RemoveSpecificPowerAction;
  84. import com.megacrit.cardcrawl.actions.utility.UseCardAction;
  85. import com.megacrit.cardcrawl.cards.AbstractCard;
  86. import com.megacrit.cardcrawl.cards.AbstractCard.CardType;
  87. import com.megacrit.cardcrawl.core.AbstractCreature;
  88. import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
  89. import com.megacrit.cardcrawl.powers.AbstractPower;
  90.  
  91. import java.util.*;
  92.  
  93. public class SpellcraftPowerExhaust extends AbstractPower {
  94.     public static final String POWER_ID = "Corruption";
  95.     public static final ArrayList<AbstractCard> Cast = new ArrayList<AbstractCard>();
  96.  
  97.     public SpellcraftPowerExhaust(AbstractCreature owner) {
  98.         this.name = "Spellcraft Pool";
  99.         this.ID = "SpellcraftPool";
  100.         this.owner = owner;
  101.         this.amount = -1;
  102.         this.description = "You are Spellcrafting!";
  103.         this.loadRegion("corruption");
  104.     }
  105.  
  106.     public void updateDescription() {
  107.         String CardsInPool = new String();
  108.         for (AbstractCard card : Cast){
  109.             CardsInPool = CardsInPool + " " + card.name;
  110.         }
  111.         this.description = "You are Spellcrafting! In the Pool are:" + " NL " + CardsInPool;
  112.     }
  113.  
  114.     public void onUseCard(AbstractCard card, UseCardAction action) {
  115.         if (card.type == CardType.SKILL) {
  116.             this.flash();
  117.             action.exhaustCard = true;
  118.         }
  119.  
  120.     }
  121.  
  122.     public void atEndOfRound() {
  123.         AbstractDungeon.actionManager.addToBottom(new RemoveSpecificPowerAction(this.owner, this.owner, "SpellcraftCast"));
  124.     }
  125. }
  126. _______________________________________________________________________________________________________________________________________
  127. //
  128. // Source code recreated from a .class file by IntelliJ IDEA
  129. // (powered by Fernflower decompiler)
  130. //
  131.  
  132. import com.megacrit.cardcrawl.actions.common.ReducePowerAction;
  133. import com.megacrit.cardcrawl.actions.common.RemoveSpecificPowerAction;
  134. import com.megacrit.cardcrawl.actions.utility.UseCardAction;
  135. import com.megacrit.cardcrawl.cards.AbstractCard;
  136. import com.megacrit.cardcrawl.cards.AbstractCard.CardType;
  137. import com.megacrit.cardcrawl.characters.AbstractPlayer;
  138. import com.megacrit.cardcrawl.core.AbstractCreature;
  139. import com.megacrit.cardcrawl.core.CardCrawlGame;
  140. import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
  141. import com.megacrit.cardcrawl.localization.PowerStrings;
  142. import com.megacrit.cardcrawl.powers.AbstractPower;
  143.  
  144. import java.util.*;
  145.  
  146. public class SpellcraftPowerCast extends AbstractPower {
  147.     public static final String POWER_ID = "Corruption";
  148.     private static final PowerStrings powerStrings;
  149.     public static final String NAME;
  150.     public static final String[] DESCRIPTIONS;
  151.     public static final ArrayList<AbstractCard> Cast = new ArrayList<AbstractCard>();
  152.  
  153.     public SpellcraftPowerCast(AbstractCreature owner) {
  154.         this.name = NAME;
  155.         this.ID = "SpellcraftPool";
  156.         this.owner = owner;
  157.         this.amount = -1;
  158.         this.description = DESCRIPTIONS[0];
  159.         this.loadRegion("corruption");
  160.     }
  161.  
  162.     public void updateDescription() {
  163.         this.description = DESCRIPTIONS[1];
  164.     }
  165.  
  166.     public void onUseCard(AbstractCard card, UseCardAction action) {
  167.         AbstractPlayer p = AbstractDungeon.player;
  168.         boolean powerExists = false;
  169.         Iterator var4 = p.powers.iterator();
  170.         while (var4.hasNext()) {
  171.             AbstractPower pow = (AbstractPower) var4.next();
  172.             if (pow.ID.equals("SpellcraftExhaust")) {
  173.                 powerExists = true;
  174.                 break;
  175.             }
  176.         }
  177.         if (card.type == CardType.SKILL && powerExists) {
  178.             Cast.add(card);
  179.         }
  180.  
  181.     }
  182.  
  183.     public ArrayList<AbstractCard> getCast(){
  184.         return Cast;
  185.     }
  186.  
  187.     static {
  188.         powerStrings = CardCrawlGame.languagePack.getPowerStrings("SpellcraftPool");
  189.         NAME = powerStrings.NAME;
  190.         DESCRIPTIONS = powerStrings.DESCRIPTIONS;
  191.     }
  192. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement