Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Magic fields bug. #218

Open
Anastaciaa opened this issue Nov 12, 2018 · 14 comments
Open

Magic fields bug. #218

Anastaciaa opened this issue Nov 12, 2018 · 14 comments
Labels
Milestone

Comments

@Anastaciaa
Copy link

Anastaciaa commented Nov 12, 2018

Normally magic fields working fine but if you shoot for example soul fire rune before, it stops working and if you stay on the field it spamming fire damge.
I'm not sure if this issue is only mine or othire.

2yecjwy

@Olddies710
Copy link

this is a problem of othire i'm olddies from otland and that bug reproduce to me too

@peonso peonso added the bug label Nov 21, 2018
@peonso peonso modified the milestones: Version 1.1, Version 1.0 Nov 21, 2018
@babymannen
Copy link

So how is it supposed to work? Not like this obviously, but should the most recent added condition (fire) always override the previous?

For example:
Shot by soul fire then step in fire field = condition from soulfire overriden and condition from fire field applied?

@Ochmar
Copy link
Contributor

Ochmar commented Dec 9, 2018

@babymannen It should deal 10 damage on step in.
No overriding.
Soulfire > fire field

@Ochmar
Copy link
Contributor

Ochmar commented Dec 25, 2018

This is due to condition "DELAYED" in soulfire.
I don't know how DELAYED + magic fields should work in general, so I'm not pushing pull request.

@Anastaciaa
Copy link
Author

This happen also with monster for example if poison spider poison you.

@pasturryx
Copy link

pasturryx commented Jan 16, 2019

.

@Wirless
Copy link

Wirless commented May 20, 2019

void MagicField::onStepInField(Creature* creature)
{
if(!creature)
return;

if(isUnstepable() || isBlocking(creature))
{
	if(!creature->isGhost())
		g_game.internalRemoveItem(creature, this, 1);

	return;
}

if(!creature->isAttackable())
	return;

const ItemType& it = items[id];
if(!it.condition)
	return;

uint32_t ownerId = getOwner();
Tile* tile = getTile();

Condition* condition = it.condition->clone();
if(ownerId && !tile->hasFlag(TILESTATE_HARDCOREZONE))
{
	if(Creature* owner = g_game.getCreatureByID(ownerId))
	{
		Player* ownerPlayer = owner->getPlayer();
		if(!ownerPlayer && owner->isPlayerSummon())
			ownerPlayer = owner->getPlayerMaster();

		bool harmful = true;
		if((g_game.getWorldType() == WORLDTYPE_OPTIONAL || tile->hasFlag(TILESTATE_OPTIONALZONE)) && ownerPlayer)
			harmful = false;
		else if(Player* player = creature->getPlayer())
		{
			if(ownerPlayer && Combat::isProtected(ownerPlayer, player))
				harmful = false;
		}

		if(!harmful || (OTSYS_TIME() - createTime) <= (uint32_t)g_config.getNumber(
			ConfigManager::FIELD_OWNERSHIP) || creature->hasBeenAttacked(ownerId))
			condition->setParam(CONDITIONPARAM_OWNER, ownerId);
	}
}

creature->addCondition(condition);

}

@Wirless
Copy link

Wirless commented May 20, 2019

purposeful function is actually depracated i had to remove it and something else within my code to make fields work properly.

@pasturryx
Copy link

Anyone has found the way to solve this issue?

@Wirless
Copy link

Wirless commented Jan 16, 2020

remove purposeful

@Wirless
Copy link

Wirless commented Jan 16, 2020

void MagicField::onStepInField(Creature* creature, bool purposeful/= true/)
to
void MagicField::onStepInField(Creature* creature)

@Wirless
Copy link

Wirless commented Jan 16, 2020

and if(ownerId != 0 && purposeful){

if(ownerId != 0){

@pasturryx
Copy link

its working without flaws, u tested it man?
@Wirless you could make a PR

@waqmaz93
Copy link

waqmaz93 commented Dec 3, 2021

its also in tfs 1.4 like that. does someone know how should it work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants