1
0

Added wither damage type, wither entity effect.

This commit is contained in:
archshift 2014-06-08 21:51:55 -07:00
parent 2574573c88
commit 814cdca054
4 changed files with 21 additions and 1 deletions

View File

@ -363,6 +363,7 @@ AString DamageTypeToString(eDamageType a_DamageType)
case dtLightning: return "dtLightning"; case dtLightning: return "dtLightning";
case dtOnFire: return "dtOnFire"; case dtOnFire: return "dtOnFire";
case dtPoisoning: return "dtPoisoning"; case dtPoisoning: return "dtPoisoning";
case dtWithering: return "dtWithering";
case dtPotionOfHarming: return "dtPotionOfHarming"; case dtPotionOfHarming: return "dtPotionOfHarming";
case dtRangedAttack: return "dtRangedAttack"; case dtRangedAttack: return "dtRangedAttack";
case dtStarving: return "dtStarving"; case dtStarving: return "dtStarving";
@ -408,6 +409,7 @@ eDamageType StringToDamageType(const AString & a_DamageTypeString)
{ dtCactusContact, "dtCactusContact"}, { dtCactusContact, "dtCactusContact"},
{ dtLavaContact, "dtLavaContact"}, { dtLavaContact, "dtLavaContact"},
{ dtPoisoning, "dtPoisoning"}, { dtPoisoning, "dtPoisoning"},
{ dtWithering, "dtWithering"},
{ dtOnFire, "dtOnFire"}, { dtOnFire, "dtOnFire"},
{ dtFireContact, "dtFireContact"}, { dtFireContact, "dtFireContact"},
{ dtInVoid, "dtInVoid"}, { dtInVoid, "dtInVoid"},
@ -433,6 +435,7 @@ eDamageType StringToDamageType(const AString & a_DamageTypeString)
{ dtCactusContact, "dtCacti"}, { dtCactusContact, "dtCacti"},
{ dtLavaContact, "dtLava"}, { dtLavaContact, "dtLava"},
{ dtPoisoning, "dtPoison"}, { dtPoisoning, "dtPoison"},
{ dtWithering, "dtWither"},
{ dtOnFire, "dtBurning"}, { dtOnFire, "dtBurning"},
{ dtFireContact, "dtInFire"}, { dtFireContact, "dtInFire"},
{ dtAdmin, "dtPlugin"}, { dtAdmin, "dtPlugin"},

View File

@ -811,6 +811,7 @@ enum eDamageType
dtCactusContact, // Contact with a cactus block dtCactusContact, // Contact with a cactus block
dtLavaContact, // Contact with a lava block dtLavaContact, // Contact with a lava block
dtPoisoning, // Having the poison effect dtPoisoning, // Having the poison effect
dtWithering, // Having the wither effect
dtOnFire, // Being on fire dtOnFire, // Being on fire
dtFireContact, // Standing inside a fire block dtFireContact, // Standing inside a fire block
dtInVoid, // Falling into the Void (Y < 0) dtInVoid, // Falling into the Void (Y < 0)
@ -837,6 +838,7 @@ enum eDamageType
dtCacti = dtCactusContact, dtCacti = dtCactusContact,
dtLava = dtLavaContact, dtLava = dtLavaContact,
dtPoison = dtPoisoning, dtPoison = dtPoisoning,
dtWither = dtWithering,
dtBurning = dtOnFire, dtBurning = dtOnFire,
dtInFire = dtFireContact, dtInFire = dtFireContact,
dtPlugin = dtAdmin, dtPlugin = dtAdmin,

View File

@ -432,6 +432,7 @@ bool cEntity::ArmorCoversAgainst(eDamageType a_DamageType)
case dtStarving: case dtStarving:
case dtInVoid: case dtInVoid:
case dtPoisoning: case dtPoisoning:
case dtWithering:
case dtPotionOfHarming: case dtPotionOfHarming:
case dtFalling: case dtFalling:
case dtLightning: case dtLightning:

View File

@ -154,7 +154,7 @@ void cPawn::HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEffect
} }
case cEntityEffect::effPoison: 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)); int frequency = std::floor(25.0 / (double)(a_Effect.GetIntensity() + 1));
static short counter = 0; static short counter = 0;
@ -170,6 +170,20 @@ void cPawn::HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEffect
return; 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: case cEntityEffect::effFireResistance:
{ {
// TODO: Implement me! // TODO: Implement me!