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

Revscriptsys Monster #3485

Closed
Peixonauta2 opened this issue Jun 25, 2021 · 5 comments · Fixed by #3499
Closed

Revscriptsys Monster #3485

Peixonauta2 opened this issue Jun 25, 2021 · 5 comments · Fixed by #3499
Assignees
Labels
bug An issue describing unexpected behavior of code

Comments

@Peixonauta2
Copy link

Well, I don't know if this is supposed to happen, but, when I try to register a monster using revscript and register a scripted spell such as sudden death rune, rage of the skies, energy strike, it doesn't work: it causes no damage.

Steps to reproduce

  1. Register a monster using revscriptsys
  2. Set up the monster to use a scripted spell (sudden death rune or rage of the skies, for example)
  3. Wait until the monster cast it, you'll notice that it'll cause 0 damage

Expected behaviour

Cause the damage registered as minDamage and maxDamage

Actual behaviour

The monster is causing 0 damage

Environment

Windows 10

@EvilHero90
Copy link
Contributor

Show your monster file

@soul4soul
Copy link
Contributor

Check this PR for examples #2975

@Peixonauta2
Copy link
Author

Show your monster file

local mType = Game.createMonsterType("midnight asura")
local monster = {}

monster.name = "Midnight Asura"
monster.description = "a midnight asura"
monster.experience = 4100
monster.outfit = {
	lookType = 150,
	lookHead = 0,
	lookBody = 114,
	lookLegs = 90,
	lookFeet = 90,
	lookAddons = 1,
	lookMount = 0
}

monster.health = 3100
monster.maxHealth = 3100
monster.runHealth = 0
monster.race = "blood"
monster.corpse = 24644
monster.speed = 210
monster.summonCost = 0
monster.maxSummons = 0

monster.changeTarget = {
	interval = 4000,
	chance = 10
}

monster.flags = {
	summonable = false,
	attackable = true,
	hostile = true,
	convinceable = false,
	pushable = false,
	boss = false,
	illusionable = true,
	canPushItems = true,
	canPushCreatures = true,
	staticAttackChance = 80,
	targetDistance = 1,
	healthHidden = false,
	canWalkOnEnergy = false,
	canWalkOnFire = false,
	canWalkOnPoison = false
}

monster.light = {
	level = 0,
	color = 0
}

monster.voices = {
	interval = 5000,
	chance = 10,
	{text = "Ah, the sweet music of a beating heart!", yell = false},
	{text = "Death and Darkness", yell = false},
	{text = "Embrace the night!", yell = false},
	{text = "May night fall upon you!", yell = false}
}

monster.immunities = {
	{type = "paralyze", condition = true},
	{type = "outfit", condition = false},
	{type = "invisible", condition = true},
	{type = "bleed", condition = false}
}

monster.elements = {
	{type = COMBAT_PHYSICALDAMAGE, percent = 0},
	{type = COMBAT_ENERGYDAMAGE, percent = -10},
	{type = COMBAT_EARTHDAMAGE, percent = -15},
	{type = COMBAT_FIREDAMAGE, percent = 20},
	{type = COMBAT_LIFEDRAIN, percent = 0},
	{type = COMBAT_MANADRAIN, percent = 0},
	{type = COMBAT_DROWNDAMAGE, percent = 0},
	{type = COMBAT_ICEDAMAGE, percent = 20},
	{type = COMBAT_HOLYDAMAGE , percent = 0},
	{type = COMBAT_DEATHDAMAGE , percent = 100}
}

monster.attacks = {
	{name ="energy strike", interval = 2000, chance = 100, minDamage = -10, maxDamage = -100, range = 1}
}

monster.defenses = {
	defense = 55,
	armor = 55,
	{name ="combat", interval = 2000, chance = 15, type = COMBAT_HEALING, minDamage = 50, maxDamage = 100, effect = CONST_ME_MAGIC_BLUE},
	{name ="speed", interval = 2000, chance = 15, speed = {min = 320, max = 320}, duration = 5000, effect = CONST_ME_MAGIC_RED}
}

monster.loot = {
	{id = 2148, chance = 100000, maxCount = 100},
	{id = 2148, chance = 80000, maxCount = 100},
	{id = 2148, chance = 60000, maxCount = 42},
	{id = 2152, chance = 18200, maxCount = 6},
	{id = 7368, chance = 2000, maxCount = 2},
	{id = 2144, chance = 2000},
	{id = 6558, chance = 2000},
	{id = 6500, chance = 2210},
	{id = 2145, chance = 800, maxCount = 3},
	{id = 2149, chance = 900, maxCount = 3},
	{id = 2147, chance = 650, maxCount = 3},
	{id = 2146, chance = 580, maxCount = 3},
	{id = 9970, chance = 580, maxCount = 3},
	{id = 7591, chance = 700},
	{id = 2143, chance = 560},
	{id = 7404, chance = 130},
	{id = 2158, chance = 320},
	{id = 2656, chance = 300},
	{id = 9971, chance = 300},
	{id = 24630, chance = 300},
	{id = 2186, chance = 300},
	{id = 2185, chance = 90},
	{id = 24637, chance = 80},
	{id = 24631, chance = 200},
	{id = 8889, chance = 90},
	{id = 2134, chance = 100},
	{id = 2170, chance = 100},
	{id = 5944, chance = 100},
	{id = 8902, chance = 100},
	{id = 3967, chance = 100},
	{id = 8910, chance = 70},
	{id = 2154, chance = 100}
}

mType:register(monster)

@DSpeichert DSpeichert added the needs-triage Needs testing with screenshot/video confirmation label Jun 26, 2021
@soul4soul
Copy link
Contributor

soul4soul commented Jun 26, 2021

I can repo. The problem is in this block of code. Only spells named "combat" get damage assigned and scripted spells have all different names so they fall into the else block. I was always bothered by this, why can't we just set up the condition like we do for melee and have it be an optional subtable and then we can check minDamage and maxDamage for every spell. I know that would have implications to Monsters::deserializeSpell but it's more flexible...

if attack.name == "combat" then
spell:setCombatValue(attack.minDamage, attack.maxDamage)
else
local startDamage = 0
if attack.startDamage then
startDamage = attack.startDamage
end
spell:setConditionDamage(attack.minDamage, attack.maxDamage, startDamage)
end

@EvilHero90
Copy link
Contributor

I can repo. The problem is in this block of code. Only spells named "combat" get damage assigned and scripted spells have all different names so they fall into the else block. I was always bothered by this, why can't we just set up the condition like we do for melee and have it be an optional subtable and then we can check minDamage and maxDamage for every spell. I know that would have implications to Monsters::deserializeSpell but it's more flexible...

if attack.name == "combat" then
spell:setCombatValue(attack.minDamage, attack.maxDamage)
else
local startDamage = 0
if attack.startDamage then
startDamage = attack.startDamage
end
spell:setConditionDamage(attack.minDamage, attack.maxDamage, startDamage)
end

Good eye! I'll prepare a PR for it soon

EvilHero90 added a commit to EvilHero90/forgottenserver that referenced this issue Jun 26, 2021
Now damage is correctly applied to spells which are used from already existing spells
@EvilHero90 EvilHero90 mentioned this issue Jun 26, 2021
3 tasks
@EvilHero90 EvilHero90 added bug An issue describing unexpected behavior of code and removed needs-triage Needs testing with screenshot/video confirmation labels Jun 26, 2021
@ghost ghost closed this as completed in #3499 Sep 26, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue describing unexpected behavior of code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants