Terasology / ClimateConditions

A module for managing temperature, humidity, and other climate factors
0 stars 6 forks source link

feat: Weaken player when they have Hyperthermia #20

Closed ktksan closed 4 years ago

ktksan commented 4 years ago

This PR weakens the player entity while the player has a Hyperthermia Component by reducing the max health, current health and regen rate of the player. The reduced health is still mapped to an equal no. of hearts as in the original health bar. Which means if the maxHealth is now changed to 80, each heart in the health bar which was worth 10 hit points originally is now worth 8 hit points after the change. Thus on the front end the player has a similar health component as before but on the back end everything is scaled by 0.8 times. Thus all types of damage would essentially feel like they are scaled to 1/0.8 i.e 1.25 times.

skaldarnar commented 4 years ago

Long term we may think about using events to modify the health component - but I think for now this should be fine.

ktksan commented 4 years ago

depends on PR: https://github.com/Terasology/Health/pull/45

ktksan commented 4 years ago

Also depends on : https://github.com/MovingBlocks/Terasology/pull/4058

skaldarnar commented 4 years ago

The CI failed because it could not find the new event in Health. I'm wondering whether this PR should introduce a bump of the dependency...?

/home/jenkins/workspace/odules_C_ClimateConditions_PR-20/src/main/java/org/terasology/climateConditions/HyperthermiaSystem.java:33: error: cannot find symbol
import org.terasology.logic.health.event.ChangeMaxHealthEvent;
                                        ^
  symbol:   class ChangeMaxHealthEvent
  location: package org.terasology.logic.health.event
/home/jenkins/workspace/odules_C_ClimateConditions_PR-20/src/main/java/org/terasology/climateConditions/HyperthermiaSystem.java:101: error: cannot find symbol
        player.send(new ChangeMaxHealthEvent(newMaxHealth));