mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 18:57:32 +00:00
Add ability wheel and toggle abilities for enhanced gameplay
This commit is contained in:
1 parent
45a4313b70
commit
095709b9d2
9 files changed
+330
-10
No files matched your search
@@ -42,12 +42,25 @@ public class ScriptDataAbilities implements IDataAbilities {
|
||||
@Override
|
||||
public void addAbility(IAbility ability) {
|
||||
if (ability instanceof Ability) {
|
||||
data.addAbility((Ability) ability);
|
||||
Ability a = (Ability) ability;
|
||||
// Validate ability allows NPCs
|
||||
if (!a.getAllowedBy().allowsNpc()) {
|
||||
return; // Ability is PLAYER_ONLY
|
||||
}
|
||||
data.addAbility(a);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAbilityReference(String key) {
|
||||
// Validate ability exists and allows NPCs
|
||||
Ability ability = AbilityController.Instance.resolveAbility(key);
|
||||
if (ability == null) {
|
||||
return; // Ability doesn't exist
|
||||
}
|
||||
if (!ability.getAllowedBy().allowsNpc()) {
|
||||
return; // Ability is PLAYER_ONLY
|
||||
}
|
||||
data.addAbilityReference(key);
|
||||
}
|
||||
|
||||
@@ -158,6 +171,14 @@ public class ScriptDataAbilities implements IDataAbilities {
|
||||
|
||||
@Override
|
||||
public boolean executeAbility(String key, Object target) {
|
||||
// Validate ability exists and allows NPCs
|
||||
Ability ability = AbilityController.Instance.resolveAbility(key);
|
||||
if (ability == null) {
|
||||
return false; // Ability doesn't exist
|
||||
}
|
||||
if (!ability.getAllowedBy().allowsNpc()) {
|
||||
return false; // Ability is PLAYER_ONLY
|
||||
}
|
||||
EntityLivingBase targetEntity = resolveTarget(target);
|
||||
return data.executeAbility(key, targetEntity);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user