slay the spire杀戮尖塔mod制作(1)
·
之前试了试自己制作mod(然后鸽了),过来分享一下个人经验。
有错请纠正。
1.环境配置
很简单的步骤。需要先导入BaseMod.jar、ModTheSpire.jar、desktop-1.0.jar。
可以直接导入
也可以用maven配置:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>Modname</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.evacipated.cardcrawl</groupId>
<artifactId>modthespire</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>[这里写路径]/ModTheSpire.jar</systemPath>
</dependency>
<dependency>
<groupId>com.evacipated.cardcrawl</groupId>
<artifactId>baseMod</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>[这里写路径]/BaseMod.jar</systemPath>
</dependency>
<dependency>
<groupId>com.evacipated.cardcrawl</groupId>
<artifactId>desktop-1.0</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>[这里写路径]/desktop-1.0.jar</systemPath>
</dependency>
</dependencies>
<build>
<finalName>ModName</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
以上需要填写三个jar包的系统路径,我一般放在项目lib文件夹内
然后创建modthespire.json
{
"modid": "ModName",
"name": "ModName",
"author_list": [
"nanashi"
],
"description": "",
"dependencies": [
"basemod"
],
"version": "0.0.1-beta",
"sts_version": "17-03-2024"
}
mod名、作者名、版本号、描述都是可以改的,自便。
只有modid和name是必须的,其他可以空缺
modthespire.config(非必要,可以不加)
name=ModName
author=nanashi
description=null
mtsversion=0.0.1-beta
2.目录结构
只展示个人的目录结构,看个人习惯

3.枚举类
要创建自定义卡池、角色、能力类型等,就要先创建对应的枚举
自定义卡池
public class CardEnum {
@SpireEnum
public static AbstractCard.CardColor MY_CARD;
}
自定义角色
public class CharacterEnum {
@SpireEnum
public static AbstractPlayer.PlayerClass my_char;
}
自定义能力类型
public class PowerEnum {
@SpireEnum
public static AbstractPower.PowerType Stat;
}
4.注册类
创建一个带有@SpireInitializer的类,这个类会在起始时加载并调用initialize方法,把自己new一下就可以了。
public static void initialize(){
new Class_Name();
}
(未完待续。。。。)
更多推荐


所有评论(0)