Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. import com.megacrit.cardcrawl.actions.AbstractGameAction;
  2. import com.megacrit.cardcrawl.actions.common.DamageAction;
  3. import com.megacrit.cardcrawl.cards.DamageInfo;
  4. import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
  5.  
  6. // Improved version of attack action for random enemies: Non-recursive, so doesn't add to top at the wrong time and do weird things with thorns and stuff. Still must input baseDamage instead of damage.
  7. public class AttackDamageRandomEnemyAction extends AbstractGameAction {
  8.  
  9. private DamageInfo info;
  10. private AttackEffect effect;
  11.  
  12. public AttackDamageRandomEnemyAction(DamageInfo info, AttackEffect effect) {
  13. this.info = info;
  14. this.effect = effect;
  15. }
  16.  
  17. public AttackDamageRandomEnemyAction(DamageInfo info) {
  18. this(info, AttackEffect.NONE);
  19. }
  20.  
  21. public void update() {
  22. this.target = AbstractDungeon.getMonsters().getRandomMonster(null, true, AbstractDungeon.cardRandomRng);
  23. if (this.target != null) {
  24. this.info.applyPowers(this.info.owner, this.target);
  25. AbstractDungeon.actionManager.addToTop(new DamageAction(this.target, this.info, this.effect));
  26. }
  27. this.isDone = true;
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement