Page 197 of 396

Re: Ask a simple question, get a simple answer

Posted: Sun Apr 02, 2017 11:44 am
by THOM
Thanks, minmay, for the help.

But I'm a little bit confused. Is only the lock-component of your solution important for me? The function in it refers to GameMode.dm_tempLockItem. What is that? Do I have to define it somewhere first??

Re: Ask a simple question, get a simple answer

Posted: Sun Apr 02, 2017 1:21 pm
by zimberzimber
All you need is for the lock to reactivate itself, and the counter to disable the lock component when it hits 0.

Re: Ask a simple question, get a simple answer

Posted: Sun Apr 02, 2017 10:59 pm
by minmay
The dm_tempLockItem hack is used to return the item to the player's hands, so that the coinslot only accepts 1 coin at a time from stacks. Without that, it would consume the entire stack.

If you just want a lock that can be used an infinite number of times all you need is:

Code: Select all

{
  class = "Lock",
  onActivate = function(self)
    self:enable()
  end,
}

Re: Ask a simple question, get a simple answer

Posted: Mon Apr 03, 2017 3:59 am
by Isaac
If one wanted to alter its behavior, it should be possible to have it expect a stack of coins by default, whether a stack of one or more than one.

Re: Ask a simple question, get a simple answer

Posted: Sun Apr 09, 2017 7:58 pm
by zimberzimber
Is there a way to get damage done to a champion before reductions?
'onDamage' happens after reductions, and while I managed to 'un-calculate' damage for magical resistances, I'm having problems with physical because it only gets reduced by melee monster attacks, which is sort of useless considering they also shoot physical projectiles. While I could redefine all monster projectiles to deal pure damage instead of physical for the drawback of having monster protection not taken into account when taking damage from monster projectiles(And I can totally live with that), there's the part where the party could damage themselves with their own physical projectiles, which means they'll be taking more physical damage.
While that's a rather minuscule thing, I'd really like for that to not be a thing. (Because more armor = more 'bugged' damage)

And if there isn't a way and I'll have to resort to keeping that bug, will this physical damage 'un-calculation' formula work properly?

Code: Select all

local protection = champion:getCurrentStat("protection")
if protection > 0 then
	unreducedDamage = math.floor(damage + protection)
end
EDIT: Now that I think about it, I could just 'create' a new damage type (damageType = "notPhysical") and do the calculations there, but then there's the problem of the console spamming the "hurr hurr invalid damage type". Can be fixed with "Console.suppressWarnings(suppress)", but how do I use it? I tried multiple ways, which all resulted in an error.

Re: Ask a simple question, get a simple answer

Posted: Mon Apr 10, 2017 12:08 am
by minmay
zimberzimber wrote:And if there isn't a way and I'll have to resort to keeping that bug, will this physical damage 'un-calculation' formula work properly?

Code: Select all

local protection = champion:getCurrentStat("protection")
if protection > 0 then
	unreducedDamage = math.floor(damage + protection)
end
Not even close, sorry. The effect of protection is replicated by this function:

Code: Select all

function applyProtection(damage, protection, pierce)
   protection = protection-pierce
   if protection <= 0 then
      return damage
   elseif protection >= 1000 then
      return 0
   else
      return math.max(1,damage-math.floor((math.random()+0.5)*protection))
   end
end
You cannot simply undo protection because 1. it's randomized, 2. even if you could predict the state of the rng, it won't reduce damage below 1.
Just give all of your monsters' melee attacks pierce=math.huge instead. Changing their damage type wouldn't work anyway; protection doesn't have anything to do with damage type, it just applies to all melee attacks.

Re: Ask a simple question, get a simple answer

Posted: Mon Apr 10, 2017 1:00 am
by zimberzimber
Wait, protection reduces damage from melee attacks REGARDLESS of damage type? When does it happen if magical resistance is also taken into account, before or after?

Re: Ask a simple question, get a simple answer

Posted: Mon Apr 10, 2017 2:42 am
by minmay
zimberzimber wrote:Wait, protection reduces damage from melee attacks REGARDLESS of damage type?
Yes.
zimberzimber wrote:When does it happen if magical resistance is also taken into account, before or after?
Resistance applies after protection in that case, for both players and monsters.

Re: Ask a simple question, get a simple answer

Posted: Mon Apr 10, 2017 9:36 am
by zimberzimber
Please tell me charge attacks ignore protection

Re: Ask a simple question, get a simple answer

Posted: Mon Apr 10, 2017 10:27 am
by minmay
No, I'm pretty sure the only inherently special thing about secondaryActions is that (where applicable) they have a default critical multiplier of 1.5 instead of 2.5. They certainly do not ignore protection or evasion. The "bash" and "cleave" powerAttackTemplates have 10 pierce, though.

edit: oops I just realized you were probably talking about MonsterChargeComponent. MonsterChargeComponent's damage is reduced by math.floor((math.random()*0.5+0.5)*[base Protection of the champion's chest armor]), to a minimum of 0 (rather than 1). Armor skill bonus and other sources of protection do not apply, it's just the base protection of the chest armor. If they aren't wearing chest armor they take full damage.

edit2: at this point I should probably reassure you that no, I am not making this up.