use of jackiecrazy.wardance.capability.skill.ISkillCapability in project WarDance by Jackiecrazy.
the class SkillEventHandler method attackFlagS.
@SubscribeEvent(priority = EventPriority.LOWEST)
public static void attackFlagS(LivingAttackEvent e) {
if (!e.getEntityLiving().isEffectiveAi())
return;
if (e.getSource().getEntity() instanceof LivingEntity) {
final LivingEntity trueSource = (LivingEntity) e.getSource().getEntity();
final ISkillCapability cap = CasterData.getCap(trueSource);
for (Skill s : cap.getEquippedSkills()) {
cap.getSkillData(s).ifPresent(d -> s.onProc(trueSource, e, d.getState(), d, e.getEntityLiving()));
}
}
// System.out.println("attack "+e.isCanceled());
}
use of jackiecrazy.wardance.capability.skill.ISkillCapability in project WarDance by Jackiecrazy.
the class SkillEventHandler method gainMightFlags.
@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void gainMightFlags(GainMightEvent e) {
if (!e.getEntityLiving().isEffectiveAi())
return;
LivingEntity attacker = e.getEntityLiving();
final ISkillCapability cap = CasterData.getCap(e.getEntityLiving());
for (Skill s : cap.getEquippedSkills()) {
cap.getSkillData(s).ifPresent(d -> s.onProc(e.getEntityLiving(), e, d.getState(), d, null));
}
// System.out.println("might "+e.isCanceled());
}
use of jackiecrazy.wardance.capability.skill.ISkillCapability in project WarDance by Jackiecrazy.
the class SkillEventHandler method attackFlags.
@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void attackFlags(LivingAttackEvent e) {
if (!e.getEntityLiving().isEffectiveAi())
return;
if (e.getSource().getEntity() instanceof LivingEntity) {
final LivingEntity trueSource = (LivingEntity) e.getSource().getEntity();
final ISkillCapability cap = CasterData.getCap(trueSource);
for (Skill s : cap.getEquippedSkills()) {
cap.getSkillData(s).ifPresent(d -> s.onProc(trueSource, e, d.getState(), d, e.getEntityLiving()));
}
}
// System.out.println("attack "+e.isCanceled());
}
use of jackiecrazy.wardance.capability.skill.ISkillCapability in project WarDance by Jackiecrazy.
the class SkillEventHandler method deathFlagS.
@SubscribeEvent(priority = EventPriority.LOWEST)
public static void deathFlagS(LivingDeathEvent e) {
if (!e.getEntityLiving().isEffectiveAi())
return;
if (e.getSource().getEntity() instanceof LivingEntity) {
LivingEntity attacker = (LivingEntity) e.getSource().getEntity();
ISkillCapability isc = CasterData.getCap(attacker);
for (Skill s : isc.getEquippedSkills()) {
isc.getSkillData(s).ifPresent(d -> s.onProc(attacker, e, d.getState(), d, e.getEntityLiving()));
}
}
ISkillCapability isc = CasterData.getCap(e.getEntityLiving());
for (Skill s : isc.getEquippedSkills()) {
isc.getSkillData(s).ifPresent(d -> s.onProc(e.getEntityLiving(), e, d.getState(), d, null));
}
}
use of jackiecrazy.wardance.capability.skill.ISkillCapability in project WarDance by Jackiecrazy.
the class SkillEventHandler method sleep.
@SubscribeEvent(priority = EventPriority.LOWEST)
public static void sleep(PlayerWakeUpEvent e) {
boolean flag = !e.wakeImmediately() && (!e.updateWorld() || e.getPlayer().level.isDay());
if ((flag || ResourceConfig.sleepingHealsDecay == ResourceConfig.ThirdOption.FORCED) && e.getEntityLiving().isEffectiveAi()) {
if (ResourceConfig.sleepingHealsDecay != ResourceConfig.ThirdOption.FALSE) {
final ICombatCapability cap = CombatData.getCap(e.getPlayer());
float res = cap.getResolve() + 1;
cap.addFatigue(-res * cap.getTrueMaxPosture() / 10);
cap.addBurnout(-res * cap.getTrueMaxSpirit() / 10);
cap.addWounding(-res * GeneralUtils.getMaxHealthBeforeWounding(e.getPlayer()) / 10);
cap.setResolve(0);
}
ISkillCapability isc = CasterData.getCap(e.getEntityLiving());
for (Skill s : isc.getEquippedSkills()) {
if (s != null)
isc.changeSkillState(s, Skill.STATE.INACTIVE);
}
}
}
Aggregations