Praytic / youtd2

Classic community-driven session-based Tower Defense game with RPG elements.
https://youtd2.com/
MIT License
96 stars 16 forks source link

Tower abilities that work on MASS creeps should also work on CHALLENGE_MASS creeps #373

Closed Praytic closed 8 months ago

Praytic commented 9 months ago

Example of tower which doesn't follow this rule: Broken Circle of Wind

Kvel2D commented 8 months ago

Below are some notes on this issue.

Original JASS code has this function.

function ETv takes integer D0 returns integer
    local integer e7=RC[cL[D0]]
    if e7==1 then
        set e7=0
    elseif e7==7 then
        set e7=5
    endif
    return e7
endfunction

This is the creep.getSize() function used in tower scripts. It returns creep size, except if creep is CHALLENGE_MASS OR CHALLENGE_BOSS, it returns MASS or BOSS.

Note that in original youtd engine, functions like doCustomAttackDamage() also convert challenge sizes to "simple" sizes.

function doCustomAttackDamage takes integer caster,integer target,real damage,real crit_ratio,integer attack_type returns nothing
    local boolean E9v=Ic
    set damage=damage*crit_ratio*tL[TL[target]+3]*Euv(caster,RC[cL[target]])*lL[LL[caster]+OC[cL[target]]]*kL[KL[target]+OC[cL[caster]]]
    set Ic=(((crit_ratio)*1.)>1.)
    call doCustomAttackDamage_internal(bL[caster],bL[target],damage,kB[attack_type])
    set Ic=E9v
endfunction

function Euv takes integer D0,integer e7 returns real
    if e7==1 then
        set e7=0
    elseif e7==7 then
        set e7=5
    endif
    return mL[ML[D0]+e7]
endfunction

So if tower deals +100% to mass creeps, it will also deal +100% to mass challenge creeps.

There also some weirdness in tower scripts which assume that creep.getSize() returns challenge sizes. Need to fix those case by case.

Kvel2D commented 8 months ago

Closed by https://github.com/Praytic/youtd2/commit/167e49527abdd9569b98f6836788cf28936748a3