Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
cb3f3b92
Commit
cb3f3b92
authored
May 27, 2022
by
ImmuState
Committed by
Melledy
May 27, 2022
Browse files
Make sure energy drops are only processed for actual monsters.
parent
b34ab5f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/game/managers/EnergyManager/EnergyManager.java
View file @
cb3f3b92
...
@@ -303,6 +303,13 @@ public class EnergyManager {
...
@@ -303,6 +303,13 @@ public class EnergyManager {
}
}
}
}
public
void
handleMonsterEnergyDrop
(
EntityMonster
monster
,
float
hpBeforeDamage
,
float
hpAfterDamage
)
{
public
void
handleMonsterEnergyDrop
(
EntityMonster
monster
,
float
hpBeforeDamage
,
float
hpAfterDamage
)
{
// Make sure this is actually a monster.
// Note that some wildlife also has that type, like boars or birds.
String
type
=
monster
.
getMonsterData
().
getType
();
if
(!
type
.
equals
(
"MONSTER_ORDINARY"
)
&&
!
type
.
equals
(
"MONSTER_BOSS"
))
{
return
;
}
// Calculate the HP tresholds for before and after the damage was taken.
// Calculate the HP tresholds for before and after the damage was taken.
float
maxHp
=
monster
.
getFightProperty
(
FightProperty
.
FIGHT_PROP_MAX_HP
);
float
maxHp
=
monster
.
getFightProperty
(
FightProperty
.
FIGHT_PROP_MAX_HP
);
float
thresholdBefore
=
hpBeforeDamage
/
maxHp
;
float
thresholdBefore
=
hpBeforeDamage
/
maxHp
;
...
...
src/main/resources/defaults/data/EnergyDrop.json
View file @
cb3f3b92
...
@@ -156,5 +156,30 @@
...
@@ -156,5 +156,30 @@
"dropId"
:
22003100
,
"dropId"
:
22003100
,
"dropList"
:
[
"dropList"
:
[
]
]
},
{
"dropId"
:
22001000
,
"dropList"
:
[
]
},
{
"dropId"
:
22000100
,
"dropList"
:
[
]
},
{
"dropId"
:
22003000
,
"dropList"
:
[
]
},
{
"dropId"
:
22001100
,
"dropList"
:
[
]
},
{
"dropId"
:
22000000
,
"dropList"
:
[
]
}
}
]
]
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment