Anonymous

Module:Monsters: Difference between revisions

From Melvor Idle
getSpecAttackMaxHit: Implement conditional bleed/poison damage (to be reviewed again in the future)
No edit summary
(getSpecAttackMaxHit: Implement conditional bleed/poison damage (to be reviewed again in the future))
Line 357: Line 357:
     if dmg.maxRoll == 'Fixed' then
     if dmg.maxRoll == 'Fixed' then
       result = dmg.maxPercent * 10
       result = dmg.maxPercent * 10
     elseif dmgRoll == "MaxHit" then
     elseif dmg.maxRoll == 'MaxHit' then
       if dmg.character == 'Target' then
       if dmg.character == 'Target' then
         --Confusion applied damage based on the player's max hit. Gonna just ignore that one
         --Confusion applied damage based on the player's max hit. Gonna just ignore that one
Line 364: Line 364:
         result = dmg.maxPercent * normalMaxHit
         result = dmg.maxPercent * normalMaxHit
       end
       end
    elseif Shared.contains({'Bleeding', 'Poisoned'}, dmg.maxRoll) then
      -- TODO: This is limited in that there is no verification that bleed/poison
      -- can be applied to the target, it is assumed that it can and so this applies
      result = result + dmg.maxPercent * 10
     end
     end
   end
   end
Line 402: Line 406:
   local damageMultiplier = 1
   local damageMultiplier = 1
   if monster.specialAttacks[1] ~= nil then
   if monster.specialAttacks[1] ~= nil then
     local canStun = false
     local canStun, canSleep = false, false
    local canSleep = false
     for i, specAttack in pairs(monster.specialAttacks) do
     for i, specAttack in pairs(monster.specialAttacks) do
       if monster.overrideSpecialChances ~= nil then
       if monster.overrideSpecialChances ~= nil then
Line 411: Line 414:
       end
       end
       local thisMax = p.getSpecAttackMaxHit(specAttack, normalMaxHit)
       local thisMax = p.getSpecAttackMaxHit(specAttack, normalMaxHit)
       if p.canSpecAttackApplyEffect(specAttack, 'Stun') then canStun = true end
       if not canStun and p.canSpecAttackApplyEffect(specAttack, 'Stun') then canStun = true end
       if p.canSpecAttackApplyEffect(specAttack, 'Sleep') then canSleep = true end
       if not canSleep and p.canSpecAttackApplyEffect(specAttack, 'Sleep') then canSleep = true end


       if thisMax > specialMaxHit then specialMaxHit = thisMax end
       if thisMax > specialMaxHit then specialMaxHit = thisMax end