脚本属性扩展
AP导包
使用扩展功能必须到导包
yaml
"MM": "me.monsterxz.attributemm.API"
方法
Java
//获取技能类型 即type
public static String getDamageType()
//是否为damage-ap技能
public static boolean isSkill()
public static String getSkillType()
public static String getSkillMethod()
public static LivingEntity getAttacker() {}
public static LivingEntity getEntity() {}
public static Double parseValue(String string) {}
public static String[] splitData(String string) {}
判断类型
可以在新增的属性中判断技能的类型,比如在脚本属性中设定一个类型为火属性的技能。下面展示的脚本属性的runAttack()部分。
JavaScript
function runAttack(attr, attacker, entity, handle) {
if (MM.getDamageType() == "火属性") {
var damage = attr.getRandomValue(attacker, "火元素攻击", handle)
attr.addDamage(attacker, damage, handle)
}
return false
}
使用类型
设定完类型后,只有使用技能时候类型一致才会生效。使用type来判定类型。
yaml
- damage-ap{type=火属性;AttributeList={火元素攻击=100}}
默认类型
在没有配置类型的情况下,将会为null
。