Re-do disobey & execution

This commit is contained in:
Oliver 2022-05-02 23:26:19 +00:00
parent 668b5427b4
commit c82ad136ce

View File

@ -46,12 +46,8 @@ public class PetCommand implements Comparable<PetCommand> {
} }
public void handle(Pet pet, Habbo habbo, String[] data) { public void handle(Pet pet, Habbo habbo, String[] data) {
if (Emulator.getRandom().nextInt((pet.level - this.level <= 0 ? 2 : pet.level - this.level) + 2) == 0) { // check if enough energy, happiness, and randomize do or dont || should possibly add if not hungry and thirsty but @brenoepic does those - oliver
pet.say(pet.petData.randomVocal(PetVocalsType.DISOBEY)); if (this.action != null && pet.energy > this.energyCost && pet.happyness > this.happynessCost && Emulator.getRandom().nextInt((pet.level - this.level <= 0 ? 2 : pet.level - this.level) + 2) == 0) {
return;
}
if (this.action != null) {
if (this.action.petTask != pet.getTask()) { if (this.action.petTask != pet.getTask()) {
if (this.action.stopsPetWalking) { if (this.action.stopsPetWalking) {
pet.getRoomUnit().setGoalLocation(pet.getRoomUnit().getCurrentLocation()); pet.getRoomUnit().setGoalLocation(pet.getRoomUnit().getCurrentLocation());
@ -72,6 +68,15 @@ public class PetCommand implements Comparable<PetCommand> {
pet.addExperience(this.xp); pet.addExperience(this.xp);
} }
} }
} else {
// this is disobey
if (this.action.apply(pet, habbo, data)) {
pet.addEnergy(-this.energyCost / 2);
pet.addHappyness(-this.happynessCost / 2);
}
pet.say(pet.petData.randomVocal(PetVocalsType.DISOBEY));
return;
} }
} }
} }