-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Entity Combat Tree (ECT) #355
Comments
event-listeners:
combat-listener:
options:
target: ['nearest-entity', 'all-nearby-entities']
range: 10 # Distance in blocks when checking for (all) the nearest entity(ies).
timer: 2 # Time in seconds that the listener performs the expected check; unless not needed
listen-for: ['entity-health'] # Listening for the health value, calculated as 'percent remaining' from full.
rules:
combat-health-tree:
enabled: true
conditions:
is-levelled: true
actions:
# execute: ['combat-health-tree']
# Each of the numbers on the furthest left represent the 'percent of health remaining'.
combat-health-tree:
100-51: # Activate upon tracking a player if entity is at 100% health.
command: [''] # Perform command as the entity if possible?
50-16:
effect: # Perform an effect; https://hub.spigotmc.org/javadocs/spigot/org/bukkit/potion/PotionEffectType.html
BLINDNESS: 3 # Duration of effect measured in seconds.
limit: 2 # The max number of times the above effect can be performed by the entity. Count resets when combat ends if entity hasn't died. If no limit specified, assume 1 .
15-1:
stack: false # By default, stack: true ; If false, once this health measure is reached, all previous events become inaccessible. When stacked: true , or not specified, all effects within the range of health will be accessible. Any future health tree events will be stopped at this point in the stack.
effect:
HEALTH_BOOST: 5
0: #Activate upon entity reaching 0% health.
effect:
HEAL: 10
event-listeners:
combat-listener:
options:
target: ['nearest-entity', 'all-nearby-entities']
range: 10 # Distance in blocks when checking for (all) the nearest entity(ies).
timer: 2 # Time in seconds that the listener performs the expected check; unless not needed
listen-for: ['entity-damage-event'] # Listening for the health value, calculated as 'percent remaining' from full.
rules:
combat-damage-event-tree:
enabled: true
conditions:
is-levelled: true
actions:
# execute: ['combat-damage-event-tree']
combat-damage-event-tree:
ENTITY_ATTACK: #Activate upon EntityDamageEvent of same name
chance: 0.2 # Chance of rule triggering
limit: 5 # The max number of times the above effect can be performed by the entity. Count resets when combat ends if entity hasn't died. If no limit specified, assume 1 .
effect: # Perform an effect; https://hub.spigotmc.org/javadocs/spigot/org/bukkit/potion/PotionEffectType.html
WEAKNESS: 5
limit: 2
ENTITY_EXPLOSION: # Only used by Creepers and similar
chance: 0.7
effect:
BLINDNESS: 2
SLOW: 2
CONFUSION: 2
PROJECTILE: # Poison arrows maybe?
chance: 0.1
effect:
POISON: 10
limit: 3 New layout design using LM4 Listener formatting. Merged four systems into two. |
Conversation on discord branched into this: TLDR a section measuring 'accrued damage' to send messages/things to players mid-fight. |
Oath suggested "Critical Hits":
|
An updated example of the layout based on latest LM4 settings layout... functions:
- function: 'combat-health-abilities'
triggers: ['on-entity-track', 'on-entity-scan']
processes:
- process: 'combat-effect'
if:
- condition: 'entity-health'
formula: '< 100%'
- condition: 'effect-limiter'
usages: 1
cooldown: 1h
do:
- action: 'run-command'
target: ['all-nearby-players']
range: 10
command: ['tellraw %player% {"text":"You can never defeat me!","color":"red"}']
- action: 'effect-limiter'
usages: '+1'
- action: 'exit-function'
- function: 'combat-health-abilities'
triggers: ['on-entity-damage', 'on-entity-regain-health', 'on-entity-attack']
processes:
# Example of applying Critical Damage modifier to any damage applied.
# If successful, the damage sent to the player will be changed to reflect a value between the
# `min-critical-formula` and the `max-critical-formula`, with a weighted random effect applied
# so a lower level critical is more likely than a higher level critical value.
- process: 'combat-effect'
if:
- condition: 'chance'
formula: '10%'
do:
- action: 'critical'
min-critical-formula: '%entity-damage-output% * 0.5'
max-critical-formula: '%entity-damage-output% * 1.5'
# Example of applying a 'shield' to an amount of damage received.
# If successful, any damage the entity would have received will be reduced by the `apply-shields` amount.
# If the final value reduces the damage to zero, it does not gain health; simply ignores the damage.
- process: 'combat-effect'
if:
- condition: 'chance'
formula: '10%'
do:
- action: 'apply-shield'
formula: '1 + %entity-damage%'
# Example of the use of 'multiattack', where if successfully activated, will use the actions to
# by swinging to associated arm during the triggering of listened events.
- process: 'combat-effect'
if:
- condition: 'chance'
formula: '10%'
do:
- action: 'swing-main-arm'
- action: 'swing-main-arm'
- action: 'swing-off-arm'
- action: 'swing-main-arm'
- action: 'exit-function'
# Example of a remaining-health-based combat event system. The conditions check for the health being
# below or equal to a specific value. Then it sets the 'effect-limiter' conditions which check for
# things like cooldown and usage limits, which are applied in the actions. This method allows multiple
# 'special' attacks with different 'usage' values acting like a pool of abilities to choose from.
# Each process below helps to demonstrate a different aspect of this particular thread of system tools.
- process: 'combat-effect'
if:
- condition: 'entity-health'
formula: '<= 70%'
- condition: 'chance'
formula: '25%'
- condition: 'effect-limiter'
usages: 2
cooldown: 1h
do:
- action: 'apply-effect'
effect: ['BLINDNESS']
target: ['all-nearby-players']
range: 10
- action: 'run-command'
command: ['tellraw %player% {"text":"Now you see me, now you don''t!","color":"red"}']
- action: 'effect-limiter'
usages: '+1'
- process: 'combat-effect'
if:
- condition: 'entity-health'
formula: '<= 40%'
- condition: 'chance'
formula: '15%'
- condition: 'effect-limiter'
usages: 1
cooldown: 1h
do:
- action: 'apply-effect'
effect: ['WITHER']
strength: 2
duration: 5s
target: ['nearest-player']
range: 10
area-effect: true # Uses the 'toss' mechanic discussed in Discord
- action: 'run-command'
command: ['tellraw %player% {"text":"You shall WITHER!","color":"red"}']
- action: 'effect-limiter'
usages: '+1'
- process: 'combat-effect'
if:
- condition: 'entity-health'
formula: '<= 20%'
- condition: 'chance'
formula: '10%'
- condition: 'effect-limiter'
usages: 1
cooldown: 1h
do:
- action: 'apply-effect'
effect: ['regeneration']
strength: 3
duration: 10s
target: ['entity']
- action: 'run-command'
command: ['tellraw %player% {"text":"A second wind blows!","color":"red"}']
- action: 'effect-limiter'
usages: '+1'
# Took the 'swarm' suggestion and placed it within the Combat Tree suggestion where I thought it fit better.
- process: 'engage-swarm'
if:
- condition: 'entity-type'
in-list: ['zombie']
- condition: 'entity-owner'
not-in-list: []
- condition: 'chance'
value: 0.05
do:
- action: 'activate-swarm'
duration: 5s
# An example of events and effects which could happen at the end of combat after the entity
# has been successfully killed. In this section there are opportunities to add things like
# measuring the victor of a kill by the player who contributed the most damage to the entity
# rather than 'last blood' (suggesting perhaps a PDC for players which store their damage
# to specific entities over a cooldown amount of time)
- process: 'combat-effect-on-death'
if:
- condition: 'entity-death'
- condition: 'chance'
formula: '100%'
do:
- action: 'clear-effects'
target: ['all-nearby-players']
range: 10
- action: 'run-command'
command: ['tellraw %player% {"text":"I am slain!","color":"yellow"}']
- action: 'custom-drops'
droptable-id:
in-list: ['nameOfTable']
- action: 'exit-function'
# An example of modifying an entity (could be done mid-battle, however likely best suited for
# after a successful kill by the entity).
- process: 'combat-effect-on-kill'
if:
- condition: 'entity-killed-player'
#- condition: 'entity-killed-entity'
- condition: 'chance'
formula: '100%'
do:
- action: 'set-level'
target: ['entity']
formula: '1 + %entity-level%'
- action: 'set-base'
target: ['entity']
base: 'max-health'
formula: '5 + %entity-base%'
- action: 'set-base'
target: ['entity']
base: 'attack-damage'
formula: '10% + %entity-base%'
- action: 'exit-function' #432 - Took the custom attacks system and merged into this via the #441 - Took the swarm event system and merged into this via the #431 - This system already included the ability to apply effects to players; incorporated the recently discussed #317 / #349 - The 'custom base attribute' mechanism plus the bloodthirsty level-up mechanism combined to form the final process listed. |
Entity Combat Tree (ECT)
This concept was originally being developed as an expansion to the above 'Soft CustomEntity Reconstruction'. With LM4, it can and will be adjusted to fit within the new Listener based system.
Section One - The Abilities
Currently I do not have many concepts for what should occur if X event occurs. I am currently using
command
andeffect
.command
functions in similar way to how command works in CustomDrops; perform established command.effect
uses the https://hub.spigotmc.org/javadocs/spigot/org/bukkit/potion/PotionEffectType.html as a reference when populating possible effects, and it's duration time. Below represents the layout, where X is the duration of effect.Each
command
andeffect
can include achance
component as to whether this would always occur or occur at random chance. This is separate from any chance or conditions established by implementing the entity via a Custom Rule.There is also the
limit
function, which would prevent the entity from performing a specific event endlessly. There are two options for calculating limits on events: a limit set to apply to the checked event or amount, as well as a method of limiting specific effects.If a limit is set for the condition, for example
ENTITY_ATTACK
, then that means any effect or command under that entity could only run X times. If a limit is set for the specific event, then that particular event would have a limited number of runs compared to any other effect. It will never occur more times than the 'master limit' as demonstrated above. (I'm tired so didn't clarify this, but can at a later date; lots to write!)There is also the
stack: false
config option. I believe by default this should be set to true.By default, the
entity_health
andentity_damage-amount
sections would stack all possible options and process them together. For example, using the config demo above (assumingstack: true
), if a newly spawned full health entity approached me to attack, then all options listed on the entity_health would be lumped together from 100% health to 0% health and be processed together. As an entity looses health, they begin to loose access to their higher-health abilities.A similar ability would occur with
entity_damage-amount
, using the config demo above (assumingstack: true
), if an entity performed 10 damage to a player, then it would process all damage events from 10 damage down to 0.With
stack: false
, both sections would be processed slightly differently:entity_health
andentity_damage-amount
would both instead only use the highest possible option.If an entity approaches the same player with full health, then only the full health effects and commands would be accessible. As the entity reduces in health, the higher health tiers become inaccessible as they go down the tiers until they run out of all health. Each tier would activate it's own set of conditions.
If the same entity was to perform 10hp damage on the same player, then the closest tier would be
8
in the demo, so only that tier would be accessible. This would be useful for establishing 'special' attacks based on the entity's strength.These statistics could be stored in the PCD of that particular entity, and reset after a set amount of time after entity stops tracking player (similar to how we prevent repeat updates in Player Levelling). Unless there are better solutions available. I am also actively looking for other potential 'events' to activate, but for now the two would be a good starting point.
Section Two - Entity Health Tree
This section represents a condition check on the entity's remaining health points.
In the above example, I am checking the entity's health at
100%
,50%
,15%
, and0%
.When an entity's health is checked at
100%
, as entities spawn at full health typically, this would not activate until an entity has started tracking a player in hostile manner. When an entity is killed, the0%
events are performed. This is the only health value which cannot be stacked, as it occurs when the entity has already died, and thus is a final 'event' to occur upon the entity's death.If
chance
is not specified, it is assumed 100% to occur, due to the nature of the system.All possible options would be collected together (excluding any particular health option which has
stack: false
), and the chances and probabilities are processed out. Effects/Commands occur, and the battle continues. This health check can be performed as a player attacks the entity, upon successful hit, determine remaining hp and process it's abilities.By default, all events and commands target the player. If you want the event or command to target the specific entity, then add the line
target: ENTITY
or similar idea.Once the entity goes to anywhere between 0-99% of total health, they would lose access to the
100%
tier of commands or effects to join the possible processing, again along with any otherstack: false
set ability. Once it goes to 0-49, the same effect occurs but to the top two options.Section Three - Entity Damage Event Tree
This section represents a condition check on the entity's method of attack. Due to my lack of knowledge on how entity's attack, I made the section a bit flexible. Will take research to determine the best 'defaults' to present to people.
Here I am referencing https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityDamageEvent.DamageCause.html when selecting the damage-event. When this event occurs from the entity, any effects/commands are performed using the same structure as demonstrated above, specifically regarding the limits and arrangement.
This is a much shorter section since the rest of the system is described above.
Section Four - Entity Damage Amount Tree
This section represents a condition check on the amount of damage an entity just performed against a player.
Here I am referencing https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityDamageEvent.html#getDamage() when determining the amount of damage caused. I am unsure what this value can be, so used regular health amounts as the example. Will require research to find good/valid default values.
Just like the other sections, this uses the same system of limits and arrangement as above.
Section Five - Entity Ability Tree
This section represents pure abilities that are potentially performed on a timer system during combat.
This section would 'activate' upon the entity tracking the player AND being within X blocks of player (unsure if this is too resource intensive; could limit to tracking initiation or after first entity landed hit; can research effects using different methods). Once activated, a timer will begin and all abilities would be evaluated at the end of the timer. Whether it runs or not, the timer resets and won't try again until the next time it reaches the count for the possible ability. If no timer is set, use a default internal of perhaps 10 for safety sake?
Can elaborate further, but exhausted. If needed will do once the project gets off the ground.
Originally posted by @UltimaOath in #317 (comment)
The text was updated successfully, but these errors were encountered: