diff options
author | archshift <admin@archshift.com> | 2014-06-09 06:51:55 +0200 |
---|---|---|
committer | archshift <admin@archshift.com> | 2014-06-17 20:39:21 +0200 |
commit | 814cdca054bec5826b491f6d9d9867ce587d2def (patch) | |
tree | f5c452b3433955cf376c1c19a72f242c36ebe688 /src | |
parent | Monster: added IsUndead(), undead-specific entity effects (diff) | |
download | cuberite-814cdca054bec5826b491f6d9d9867ce587d2def.tar cuberite-814cdca054bec5826b491f6d9d9867ce587d2def.tar.gz cuberite-814cdca054bec5826b491f6d9d9867ce587d2def.tar.bz2 cuberite-814cdca054bec5826b491f6d9d9867ce587d2def.tar.lz cuberite-814cdca054bec5826b491f6d9d9867ce587d2def.tar.xz cuberite-814cdca054bec5826b491f6d9d9867ce587d2def.tar.zst cuberite-814cdca054bec5826b491f6d9d9867ce587d2def.zip |
Diffstat (limited to '')
-rw-r--r-- | src/BlockID.cpp | 3 | ||||
-rw-r--r-- | src/BlockID.h | 2 | ||||
-rw-r--r-- | src/Entities/Entity.cpp | 1 | ||||
-rw-r--r-- | src/Entities/Pawn.cpp | 16 |
4 files changed, 21 insertions, 1 deletions
diff --git a/src/BlockID.cpp b/src/BlockID.cpp index bfe826f40..8edc51664 100644 --- a/src/BlockID.cpp +++ b/src/BlockID.cpp @@ -363,6 +363,7 @@ AString DamageTypeToString(eDamageType a_DamageType) case dtLightning: return "dtLightning"; case dtOnFire: return "dtOnFire"; case dtPoisoning: return "dtPoisoning"; + case dtWithering: return "dtWithering"; case dtPotionOfHarming: return "dtPotionOfHarming"; case dtRangedAttack: return "dtRangedAttack"; case dtStarving: return "dtStarving"; @@ -408,6 +409,7 @@ eDamageType StringToDamageType(const AString & a_DamageTypeString) { dtCactusContact, "dtCactusContact"}, { dtLavaContact, "dtLavaContact"}, { dtPoisoning, "dtPoisoning"}, + { dtWithering, "dtWithering"}, { dtOnFire, "dtOnFire"}, { dtFireContact, "dtFireContact"}, { dtInVoid, "dtInVoid"}, @@ -433,6 +435,7 @@ eDamageType StringToDamageType(const AString & a_DamageTypeString) { dtCactusContact, "dtCacti"}, { dtLavaContact, "dtLava"}, { dtPoisoning, "dtPoison"}, + { dtWithering, "dtWither"}, { dtOnFire, "dtBurning"}, { dtFireContact, "dtInFire"}, { dtAdmin, "dtPlugin"}, diff --git a/src/BlockID.h b/src/BlockID.h index 272fd319d..e3567b6fc 100644 --- a/src/BlockID.h +++ b/src/BlockID.h @@ -811,6 +811,7 @@ enum eDamageType dtCactusContact, // Contact with a cactus block dtLavaContact, // Contact with a lava block dtPoisoning, // Having the poison effect + dtWithering, // Having the wither effect dtOnFire, // Being on fire dtFireContact, // Standing inside a fire block dtInVoid, // Falling into the Void (Y < 0) @@ -837,6 +838,7 @@ enum eDamageType dtCacti = dtCactusContact, dtLava = dtLavaContact, dtPoison = dtPoisoning, + dtWither = dtWithering, dtBurning = dtOnFire, dtInFire = dtFireContact, dtPlugin = dtAdmin, diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index ba829bf6b..06833e1ba 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -432,6 +432,7 @@ bool cEntity::ArmorCoversAgainst(eDamageType a_DamageType) case dtStarving: case dtInVoid: case dtPoisoning: + case dtWithering: case dtPotionOfHarming: case dtFalling: case dtLightning: diff --git a/src/Entities/Pawn.cpp b/src/Entities/Pawn.cpp index fee595e54..51ffc46b2 100644 --- a/src/Entities/Pawn.cpp +++ b/src/Entities/Pawn.cpp @@ -154,7 +154,7 @@ void cPawn::HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEffect } case cEntityEffect::effPoison: { - // Poison frequency = 25 ticks, divided by potion level (Poison II = 25 ticks) + // Poison frequency = 25 ticks, divided by potion level (Poison II = 12 ticks) int frequency = std::floor(25.0 / (double)(a_Effect.GetIntensity() + 1)); static short counter = 0; @@ -170,6 +170,20 @@ void cPawn::HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEffect return; } + case cEntityEffect::effWither: + { + // Poison frequency = 40 ticks, divided by effect level (Wither II = 20 ticks) + int frequency = std::floor(25.0 / (double)(a_Effect.GetIntensity() + 1)); + + static short counter = 0; + if (++counter >= frequency) + { + TakeDamage(dtWither, a_Effect.GetUser(), 1, 0); + counter = 0; + } + //TODO: "<Player> withered away> + return; + } case cEntityEffect::effFireResistance: { // TODO: Implement me! |