Skip to content

Commit

Permalink
Allow copying AbilityAttributes values.
Browse files Browse the repository at this point in the history
  • Loading branch information
nightm4re94 committed Oct 5, 2024
1 parent 141f0d7 commit 4b3e1e3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,18 @@ public Attribute<Integer> range() {
public Attribute<Integer> value() {
return this.value;
}

/**
* Copies the values from another `AbilityAttributes` instance to this instance.
*
* @param otherAttributes the `AbilityAttributes` instance from which to copy values
*/
public void copyValues(AbilityAttributes otherAttributes) {
cooldown().setBaseValue(otherAttributes.cooldown().getBase());
duration().setBaseValue(otherAttributes.duration().getBase());
impact().setBaseValue(otherAttributes.impact().getBase());
impactAngle().setBaseValue(otherAttributes.impactAngle().getBase());
range().setBaseValue(otherAttributes.range().getBase());
value().setBaseValue(otherAttributes.value().getBase());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ public Creature(String spritesheetName) {
if (spritesheetName != null) {
this.setSpritesheetName(spritesheetName);
} else {
this.setSpritesheetName(
Game.random()
.choose(EntityAnimationController.getDefaultSpritePrefixes(getClass())));
this.setSpritesheetName(Game.random().choose(EntityAnimationController.getDefaultSpritePrefixes(getClass())));
}
}

Expand Down

0 comments on commit 4b3e1e3

Please sign in to comment.