introduce drowning condition, fix monsters to use uniform random, fix poison field on walk instant damage hit, need to check how drowning works and remove damage only when player is idle for 4s

This commit is contained in:
ErikasKontenis
2019-12-04 22:00:18 +02:00
parent a28bfd7171
commit 4a87cd754c
10 changed files with 57 additions and 16 deletions

View File

@@ -916,6 +916,21 @@ bool ConditionDamage::executeCondition(Creature* creature, int32_t)
} else {
return false;
}
} else if (conditionType == CONDITION_DROWN) {
const int32_t r_cycle = cycle;
if (r_cycle) {
if (count <= 0) {
count = max_count;
cycle = r_cycle + 2 * (r_cycle <= 0) - 1;
doDamage(creature, -20);
}
else {
--count;
}
}
else {
return false;
}
}
return true;

View File

@@ -255,6 +255,8 @@ class ConditionDamage final : public Condition
count = max_count = 8;
} else if (type == CONDITION_ENERGY) {
count = max_count = 10;
} else if (type == CONDITION_DROWN) {
count = max_count = 3;
}
}

View File

@@ -515,7 +515,6 @@ bool Items::loadItems()
items[id].conditionDamage.reset(conditionDamage);
} else if (identifier == "poison") {
conditionDamage = new ConditionDamage(CONDITIONID_COMBAT, CONDITION_POISON);
conditionDamage->setParam(CONDITION_PARAM_DELAYED, true);
combatType = COMBAT_EARTHDAMAGE;
items[id].combatType = combatType;
items[id].conditionDamage.reset(conditionDamage);

View File

@@ -1154,6 +1154,7 @@ void LuaScriptInterface::registerFunctions()
registerEnum(CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT)
registerEnum(CONDITION_PARAM_STAT_MAGICPOINTSPERCENT)
registerEnum(CONDITION_PARAM_PERIODICDAMAGE)
registerEnum(CONDITION_PARAM_HIT_DAMAGE)
registerEnum(CONDITION_PARAM_SKILL_MELEEPERCENT)
registerEnum(CONDITION_PARAM_SKILL_FISTPERCENT)
registerEnum(CONDITION_PARAM_SKILL_CLUBPERCENT)

View File

@@ -876,7 +876,7 @@ void Monster::doAttacking(uint32_t)
for (spellBlock_t& spellBlock : mType->info.attackSpells) {
if (spellBlock.range != 0 && std::max<uint32_t>(Position::getDistanceX(myPos, targetPos), Position::getDistanceY(myPos, targetPos)) <= spellBlock.range) {
if (normal_random(0, spellBlock.chance) == 0 && (master || health > mType->info.runAwayHealth || normal_random(1, 3) == 1)) {
if (uniform_random(0, spellBlock.chance) == 0 && (master || health > mType->info.runAwayHealth || uniform_random(1, 3) == 1)) {
updateLookDirection();
minCombatValue = spellBlock.minCombatValue;
@@ -977,7 +977,7 @@ void Monster::onThinkTarget(uint32_t interval)
void Monster::onThinkDefense(uint32_t)
{
for (const spellBlock_t& spellBlock : mType->info.defenseSpells) {
if (normal_random(0, spellBlock.chance) == 0 && (master || health > mType->info.runAwayHealth || normal_random(1, 3) == 1)) {
if (uniform_random(0, spellBlock.chance) == 0 && (master || health > mType->info.runAwayHealth || uniform_random(1, 3) == 1)) {
minCombatValue = spellBlock.minCombatValue;
maxCombatValue = spellBlock.maxCombatValue;
spellBlock.spell->castSpell(this, this);