Skip to content

Commit 6601bf3

Browse files
committed
添加了基础防御卡
1 parent 446d8bb commit 6601bf3

File tree

15 files changed

+125
-12
lines changed

15 files changed

+125
-12
lines changed

src/main/java/tentianqinyin/BasicMod.java

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package tentianqinyin;
22

3+
import basemod.AutoAdd;
34
import basemod.BaseMod;
4-
import basemod.interfaces.EditKeywordsSubscriber;
5-
import basemod.interfaces.EditStringsSubscriber;
6-
import basemod.interfaces.PostInitializeSubscriber;
5+
import basemod.interfaces.*;
6+
import tentianqinyin.cards.BaseCard;
7+
import tentianqinyin.character.TenTianQinYin;
78
import tentianqinyin.util.GeneralUtils;
89
import tentianqinyin.util.KeywordInfo;
910
import tentianqinyin.util.TextureLoader;
@@ -29,6 +30,8 @@
2930

3031
@SpireInitializer
3132
public class BasicMod implements
33+
EditCardsSubscriber,
34+
EditCharactersSubscriber,
3235
EditStringsSubscriber,
3336
EditKeywordsSubscriber,
3437
PostInitializeSubscriber {
@@ -47,6 +50,8 @@ public static String makeID(String id) {
4750
//This will be called by ModTheSpire because of the @SpireInitializer annotation at the top of the class.
4851
public static void initialize() {
4952
new BasicMod();
53+
54+
TenTianQinYin.Meta.registerColor();
5055
}
5156

5257
public BasicMod() {
@@ -219,4 +224,17 @@ private static void loadModInfo() {
219224
throw new RuntimeException("Failed to determine mod info/ID based on initializer.");
220225
}
221226
}
227+
228+
@Override
229+
public void receiveEditCharacters() {
230+
TenTianQinYin.Meta.registerCharacter();
231+
}
232+
233+
@Override
234+
public void receiveEditCards() {
235+
new AutoAdd(modID) //Loads files from this mod
236+
.packageFilter(BaseCard.class) //In the same package as this class
237+
.setDefaultSeen(true) //And marks them as seen in the compendium
238+
.cards(); //Adds the cards
239+
}
222240
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package tentianqinyin.cards.BasicCard;
2+
3+
import com.megacrit.cardcrawl.actions.AbstractGameAction;
4+
import com.megacrit.cardcrawl.actions.common.DamageAction;
5+
import com.megacrit.cardcrawl.actions.common.GainBlockAction;
6+
import com.megacrit.cardcrawl.cards.DamageInfo;
7+
import com.megacrit.cardcrawl.characters.AbstractPlayer;
8+
import com.megacrit.cardcrawl.monsters.AbstractMonster;
9+
import tentianqinyin.cards.BaseCard;
10+
import tentianqinyin.character.TenTianQinYin;
11+
import tentianqinyin.util.CardStats;
12+
13+
public class BasicExpressive extends BaseCard {
14+
public static final String ID = makeID(BasicExpressive.class.getSimpleName());
15+
private static final CardStats info = new CardStats(
16+
TenTianQinYin.Meta.CARD_COLOR, //The card color. If you're making your own character, it'll look something like this. Otherwise, it'll be CardColor.RED or similar for a basegame character color.
17+
CardType.SKILL, //The type. ATTACK/SKILL/POWER/CURSE/STATUS
18+
CardRarity.BASIC, //Rarity. BASIC is for starting cards, then there's COMMON/UNCOMMON/RARE, and then SPECIAL and CURSE. SPECIAL is for cards you only get from events. Curse is for curses, except for special curses like Curse of the Bell and Necronomicurse.
19+
CardTarget.SELF, //The target. Single target is ENEMY, all enemies is ALL_ENEMY. Look at cards similar to what you want to see what to use.
20+
0 //The card's base cost. -1 is X cost, -2 is no cost for unplayable cards like curses, or Reflex.
21+
);
22+
23+
//These will be used in the constructor. Technically you can just use the values directly,
24+
//but constants at the top of the file are easy to adjust.
25+
private static final int BLOCK = 4;
26+
private static final int UPG_BLOCK = 1;
27+
28+
public BasicExpressive() {
29+
super(ID, info); //Pass the required information to the BaseCard constructor.
30+
31+
setBlock(BLOCK, UPG_BLOCK); //Sets the card's damage and how much it changes when upgraded.
32+
33+
tags.add(CardTags.STARTER_DEFEND);
34+
}
35+
36+
@Override
37+
public void use(AbstractPlayer p, AbstractMonster m) {
38+
addToBot(new GainBlockAction(p, block));
39+
}
40+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package tentianqinyin.cards.BasicCard;
2+
3+
import com.megacrit.cardcrawl.actions.AbstractGameAction;
4+
import com.megacrit.cardcrawl.actions.common.DamageAction;
5+
import com.megacrit.cardcrawl.cards.DamageInfo;
6+
import com.megacrit.cardcrawl.characters.AbstractPlayer;
7+
import com.megacrit.cardcrawl.monsters.AbstractMonster;
8+
import tentianqinyin.cards.BaseCard;
9+
import tentianqinyin.character.TenTianQinYin;
10+
import tentianqinyin.util.CardStats;
11+
12+
import javax.smartcardio.Card;
13+
14+
public class BasicPerformance extends BaseCard {
15+
public static final String ID = makeID(BasicPerformance.class.getSimpleName());
16+
private static final CardStats info = new CardStats(
17+
TenTianQinYin.Meta.CARD_COLOR, //The card color. If you're making your own character, it'll look something like this. Otherwise, it'll be CardColor.RED or similar for a basegame character color.
18+
CardType.ATTACK, //The type. ATTACK/SKILL/POWER/CURSE/STATUS
19+
CardRarity.BASIC, //Rarity. BASIC is for starting cards, then there's COMMON/UNCOMMON/RARE, and then SPECIAL and CURSE. SPECIAL is for cards you only get from events. Curse is for curses, except for special curses like Curse of the Bell and Necronomicurse.
20+
CardTarget.ENEMY, //The target. Single target is ENEMY, all enemies is ALL_ENEMY. Look at cards similar to what you want to see what to use.
21+
1 //The card's base cost. -1 is X cost, -2 is no cost for unplayable cards like curses, or Reflex.
22+
);
23+
24+
//These will be used in the constructor. Technically you can just use the values directly,
25+
//but constants at the top of the file are easy to adjust.
26+
private static final int DAMAGE = 9;
27+
private static final int UPG_DAMAGE = 3;
28+
29+
public BasicPerformance() {
30+
super(ID, info); //Pass the required information to the BaseCard constructor.
31+
32+
setDamage(DAMAGE, UPG_DAMAGE); //Sets the card's damage and how much it changes when upgraded.
33+
34+
tags.add(CardTags.STARTER_STRIKE);
35+
tags.add(CardTags.STRIKE);
36+
}
37+
38+
@Override
39+
public void use(AbstractPlayer p, AbstractMonster m) {
40+
addToBot(new DamageAction(m,
41+
new DamageInfo(p,
42+
damage,
43+
DamageInfo.DamageType.NORMAL), AbstractGameAction.AttackEffect.SLASH_VERTICAL));
44+
}
45+
46+
47+
}

src/main/java/tentianqinyin/character/MyCharacter.java renamed to src/main/java/tentianqinyin/character/TenTianQinYin.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import static tentianqinyin.BasicMod.characterPath;
2929
import static tentianqinyin.BasicMod.makeID;
3030

31-
public class MyCharacter extends CustomPlayer {
31+
public class TenTianQinYin extends CustomPlayer {
3232
//Stats
3333
public static final int ENERGY_PER_TURN = 3;
3434
public static final int MAX_HP = 70;
@@ -46,10 +46,10 @@ public static class Meta {
4646
//These are used to identify your character, as well as your character's card color.
4747
//Library color is basically the same as card color, but you need both because that's how the game was made.
4848
@SpireEnum
49-
public static PlayerClass YOUR_CHARACTER;
50-
@SpireEnum(name = "CHARACTER_GRAY_COLOR") // These two MUST match. Change it to something unique for your character.
49+
public static PlayerClass TENTIANQINYIN;
50+
@SpireEnum(name = "TENTIANQINYIN_COLOR") // These two MUST match. Change it to something unique for your character.
5151
public static AbstractCard.CardColor CARD_COLOR;
52-
@SpireEnum(name = "CHARACTER_GRAY_COLOR") @SuppressWarnings("unused")
52+
@SpireEnum(name = "TENTIANQINYIN_COLOR") @SuppressWarnings("unused")
5353
public static CardLibrary.LibraryType LIBRARY_COLOR;
5454

5555
//Character select images
@@ -79,7 +79,7 @@ public static void registerColor() {
7979
}
8080

8181
public static void registerCharacter() {
82-
BaseMod.addCharacter(new MyCharacter(), CHAR_SELECT_BUTTON, CHAR_SELECT_PORTRAIT);
82+
BaseMod.addCharacter(new TenTianQinYin(), CHAR_SELECT_BUTTON, CHAR_SELECT_PORTRAIT);
8383
}
8484
}
8585

@@ -116,8 +116,8 @@ public static void registerCharacter() {
116116

117117
//Actual character class code below this point
118118

119-
public MyCharacter() {
120-
super(getNames()[0], Meta.YOUR_CHARACTER,
119+
public TenTianQinYin() {
120+
super(getNames()[0], Meta.TENTIANQINYIN,
121121
new CustomEnergyOrb(orbTextures, characterPath("energyorb/vfx.png"), layerSpeeds), //Energy Orb
122122
new SpriterAnimation(characterPath("animation/default.scml"))); //Animation
123123

@@ -256,6 +256,6 @@ public AbstractCard.CardColor getCardColor() {
256256
@Override
257257
public AbstractPlayer newInstance() {
258258
//Makes a new instance of your character class.
259-
return new MyCharacter();
259+
return new TenTianQinYin();
260260
}
261261
}
15.5 KB
Loading
38.3 KB
Loading
15.8 KB
Loading
40.8 KB
Loading
-544 Bytes
Loading
-8.47 KB
Loading

0 commit comments

Comments
 (0)