DarkstarProject / darkstar

DEPRECATED - FFXI Server Emulator - See Project Topaz
https://github.com/project-topaz/topaz
GNU General Public License v3.0
455 stars 551 forks source link

Cover ability not present. #5095

Open Dynas13 opened 6 years ago

Dynas13 commented 6 years ago

I have:

Client Version (type /ver in game) : all

Source Branch (master/stable) : master

Additional Information (Steps to reproduce/Expected behavior) :

The status effect exists, the animation works, the necessary elements to make it happen are there but there's no development on making Cover.

Dynas13 commented 6 years ago

-- Ability: Cover
-- Allows you to protect party members by placing yourself between them and the enemy.
-- Obtained: Paladin Level 35
-- Recast Time: 3:00
-- Duration: 0:15-0:30
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/msg");
-----------------------------------
function onAbilityCheck(player,target,ability)
    if (target == nil or target:getID() == player:getID() or not target:isPC()) then
        return dsp.msg.basic.CANNOT_ON_THAT_TARG, 0;
    else
        return 0, 0;
    end
end;

function onUseAbility(player,target,ability)
    target:addStatusEffect(player,dsp.effect.COVER,1,0,15)
end;

I'm know this is extremely basic and wrong in some points but something like this would be where I would start personally.

davismj commented 6 years ago

Do you know how to submit a PR?

teschnei commented 6 years ago

i don't think any of the necessary stuff to make it work are implemented yet (ie, the checks when being attacked for the effect)

On Mon, Jul 16, 2018 at 7:51 PM Dynas13 notifications@github.com wrote:

I have:

Client Version (type /ver in game) : all

Source Branch (master/stable) : n/a

Additional Information (Steps to reproduce/Expected behavior) :

The status effect exists, the animation works, the necessary elements to make it happen are there but there's no development on making Cover.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/DarkstarProject/darkstar/issues/5095, or mute the thread https://github.com/notifications/unsubscribe-auth/ABGI_y6LvlscOOyhSOA0X3iv7caIx0Ynks5uHUMqgaJpZM4VSDfw .

Dynas13 commented 6 years ago

Do you know how to submit a PR?

I do, but my code is missing too much for me to submit it properly. Doesn't calculate half the things that are apart of cover like the VIT formula and enmity added to paladin and subtracted from target.

Wiggo32 commented 6 years ago

also something to consider whenever someone starts working on this: -the case of 2 or more PLD's in a party, being able to determine which PLD the active cover effect belongs to

Dynas13 commented 6 years ago

I've done a lot of digging around trying to figure a way for damage transfer to work. There's stuff like transferEnmity which is for accomplice and collaborator. Or trickattackPartner which lets the code know who's receiving enmity. What I can't wrap my head around is how damage is received. I'm sure it's buried somewhere but if we could say something like

--Pseudocode------------------------------
while ability is active then
  player receives targets damage
  if damage >= 0 then
    player.addMod(dsp.mod.Enmity, +200)
    target:lowerEnmity(target, 10)
elseif gallant coronet equipped then
  transfer magical damage to player
elseif valor surcoat equipped then
  20% of damage transferred converted to mp.
end
-------------------------------------------------------
function onUseAbility(player,target,ability)
--formula from https://www.bg-wiki.com/bg/Cover
local baseDuration = 15;
local bonusTime = utils.clamp(math.floor((player:getMod(dsp.mod.VIT) + player:getMod(dsp.mod.MND) - target:getMod(dsp.mod.VIT) * 2) / 4), 0, 15)
local duration = baseDuration + bonusTime;

player:addStatusEffect(player,dsp.effect.COVER,0,0,duration)

  if target:physicalDmgTaken >= 0 then
    player.addMod(dsp.mod.Enmity, +200)
    target:lowerEnmity(target, 10)
  end
end;

I assume Gallant Coronet and Surcoat are handled within their own files instead of the ability file, if so, that wont be needed here.

TeoTwawki commented 6 years ago

@Dynas13 I code tagged your post, click edit and you can see how that was done for next time :-)