Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official Fulqrum Publishing forum > Fulqrum Publishing > King's Bounty > King`s Bounty: Warriors of the North

King`s Bounty: Warriors of the North Next game in the award-winning King’s Bounty series

Reply
 
Thread Tools Display Modes
  #1  
Old 10-31-2012, 07:57 AM
Bhruic Bhruic is offline
Approved Member
 
Join Date: Oct 2012
Posts: 233
Default

Quote:
Originally Posted by camelotcrusade View Post
2. I've never seen my alchemist or my engineer mix more than one bottle when using their remix ability. Here's what the code says (line 3026, unit_special_attacks.lua):

I can see it looks like there is a 10% chance to do better than 1 bottle. Have I just been unlucky 20+ times or might there be something wrong here?
To save space I didn't quote the code, but you can go back and look... What it actually is doing is checking if you've got the item "alchemist_toolkit" equipped on your character, and if you do, then you have a 10% chance of getting a second bottle. That's the only way it lists for that to take place.

I've never used Alchemists/Engineers in WotN, so I'm not sure if they are supposed to have the option to mix more than one without an item.
Reply With Quote
  #2  
Old 10-31-2012, 08:46 AM
Bhruic Bhruic is offline
Approved Member
 
Join Date: Oct 2012
Posts: 233
Default

Alfheim fix - the Alfheim edda is supposed to only cast beneficial spells on allies and harmful spells on enemies, but it was casting both types on any units

addon_arena.lua

original:
Code:
local tab_spell_select = {
    -- õîðîøèå çàêëû
    {s = "spell_dispell",       nf = "magic_immunitet,pawn,boss"},
    {s = "spell_haste",         nf = "magic_immunitet,pawn,boss"},
    {s = "spell_bless",         nf = "undead,magic_immunitet,pawn,boss"},
    {s = "spell_divine_armor",  nf = "undead,magic_immunitet,pawn,boss"},
    {s = "spell_reaction",      nf = "magic_immunitet,pawn,boss"},
    {s = "spell_gifts",         nf = "magic_immunitet,pawn,boss"},
    -- ïëîõèå çàêëû
    {s = "spell_defenseless",   nf = "magic_immunitet,pawn,boss"},
    {s = "spell_slow",          nf = "magic_immunitet,pawn,boss"},
    {s = "spell_magic_bondage", nf = "mind_immunitet,magic_immunitet,pawn,boss"},
    {s = "spell_pygmy",         nf = "magic_immunitet,pawn,boss"},
    {s = "spell_scare",         nf = "magic_immunitet,mind_immunitet,undead,pawn,boss"},
    {s = "spell_weakness",      nf = "undead,golem,plant,magic_immunitet,pawn,boss"},
    {s = "spell_crue_fate",     nf = "magic_immunitet,pawn,boss"}--[[,
    {s = "spell_ram",           nf = "magic_immunitet,pawn,boss,mech"}]]
  }
  local cast = {}
  local spell_count = table.getn(tab_spell_select)
  local acnt = Attack.act_count()
  local total_prob = 0
  for i = 1, spell_count do
    local spell = (tab_spell_select[i]).s
    local nfeatures = (tab_spell_select[i]).nf
    local tab_spell_targets = {}
    for j = 0, acnt-1 do
      if not Attack.act_feature(j, nfeatures) and Attack.act_takesdmg(j) then
        table.insert(tab_spell_targets, j) -- âûáîð áàçîâûõ öåëåé
      end
    end
    if table.getn(tab_spell_targets) > 0 then -- åñòü áàçîâûå öåëè
      local spell_lvl = Game.Random (1, 3) -- óðîâåíü çàêëà, êîòîðûé áóäåì þçàòü
      local applicable = Attack.build_spell_attack(spell, spell_lvl).applicable
      for i, t in ipairs (tab_spell_targets) do
        if applicable(t) then -- çàêë ïðèìåíèì íà ýòó öåëü
          local prob = 10
          total_prob = total_prob + prob
          table.insert(cast, {spell = spell, level = spell_lvl, target = t, prob = prob})
        end
      end
    end
  end
modified:
Code:
local tab_spell_select_positive = {
    -- õîðîøèå çàêëû
    {s = "spell_dispell",       nf = "magic_immunitet,pawn,boss"},
    {s = "spell_haste",         nf = "magic_immunitet,pawn,boss"},
    {s = "spell_bless",         nf = "undead,magic_immunitet,pawn,boss"},
    {s = "spell_divine_armor",  nf = "undead,magic_immunitet,pawn,boss"},
    {s = "spell_reaction",      nf = "magic_immunitet,pawn,boss"},
    {s = "spell_gifts",         nf = "magic_immunitet,pawn,boss"}
  }
  local tab_spell_select_negative = {
    -- ïëîõèå çàêëû
    {s = "spell_defenseless",   nf = "magic_immunitet,pawn,boss"},
    {s = "spell_slow",          nf = "magic_immunitet,pawn,boss"},
    {s = "spell_magic_bondage", nf = "mind_immunitet,magic_immunitet,pawn,boss"},
    {s = "spell_pygmy",         nf = "magic_immunitet,pawn,boss"},
    {s = "spell_scare",         nf = "magic_immunitet,mind_immunitet,undead,pawn,boss"},
    {s = "spell_weakness",      nf = "undead,golem,plant,magic_immunitet,pawn,boss"},
    {s = "spell_crue_fate",     nf = "magic_immunitet,pawn,boss"}--[[,
    {s = "spell_ram",           nf = "magic_immunitet,pawn,boss,mech"}]]
  }
  local cast = {}
  local acnt = Attack.act_count()
  local total_prob = 0
  local spell_count = table.getn(tab_spell_select_positive)
  for i = 1, spell_count do
    local spell = (tab_spell_select_positive[i]).s
    local nfeatures = (tab_spell_select_positive[i]).nf
    local tab_spell_targets = {}
    for j = 0, acnt-1 do
      if not Attack.act_feature(j, nfeatures) and Attack.act_takesdmg(j) and Attack.act_ally(j) then
        table.insert(tab_spell_targets, j) -- âûáîð áàçîâûõ öåëåé
      end
    end
    if table.getn(tab_spell_targets) > 0 then -- åñòü áàçîâûå öåëè
      local spell_lvl = Game.Random (1, 3) -- óðîâåíü çàêëà, êîòîðûé áóäåì þçàòü
      local applicable = Attack.build_spell_attack(spell, spell_lvl).applicable
      for i, t in ipairs (tab_spell_targets) do
        if applicable(t) then -- çàêë ïðèìåíèì íà ýòó öåëü
          local prob = 10
          total_prob = total_prob + prob
          table.insert(cast, {spell = spell, level = spell_lvl, target = t, prob = prob})
        end
      end
    end
  end
  
  spell_count = table.getn(tab_spell_select_negative)
  for i = 1, spell_count do
    local spell = (tab_spell_select_negative[i]).s
    local nfeatures = (tab_spell_select_negative[i]).nf
    local tab_spell_targets = {}
    for j = 0, acnt-1 do
      if not Attack.act_feature(j, nfeatures) and Attack.act_takesdmg(j) and Attack.act_enemy(j) then
        table.insert(tab_spell_targets, j) -- âûáîð áàçîâûõ öåëåé
      end
    end
    if table.getn(tab_spell_targets) > 0 then -- åñòü áàçîâûå öåëè
      local spell_lvl = Game.Random (1, 3) -- óðîâåíü çàêëà, êîòîðûé áóäåì þçàòü
      local applicable = Attack.build_spell_attack(spell, spell_lvl).applicable
      for i, t in ipairs (tab_spell_targets) do
        if applicable(t) then -- çàêë ïðèìåíèì íà ýòó öåëü
          local prob = 10
          total_prob = total_prob + prob
          table.insert(cast, {spell = spell, level = spell_lvl, target = t, prob = prob})
        end
      end
    end
  end
Reply With Quote
  #3  
Old 10-31-2012, 09:15 AM
saroumana saroumana is offline
Approved Member
 
Join Date: Jan 2010
Posts: 87
Default

Book of evil correction :

in spells_power.lua

Original

Quote:
function pwr_evilbook(level)
if tonumber(level) == 0 or level == nil then
level = Obj.spell_level()
if level == 0 then
level = 1
end
if Obj.where() == 6 and Obj.spell_level() ~= 0 then
level = level + 1
end
else
level = tonumber(level)
end

local level = tonumber("0" .. text_dec(Logic.obj_par("spell_evilbook", "level"), level))
local kill = tonumber("0" .. text_dec(Logic.obj_par("spell_evilbook", "kill"), level))
local creator_power = 1 + tonumber(skill_power2("creator", 1)/100)
creator_power = creator_power/2
local int_bonus = 1 + tonumber(Game.Config("spell_power_config/int_power"))*HInt()/100
local item_bonus = tonumber(Logic.hero_lu_item("sp_spell_demonologist ", "count")/100)
local bonus = math.floor(100*(creator_power + int_bonus)*int_bonus)

return bonus, level, kill
end
CHANGE

Quote:
function pwr_evilbook(level)
if tonumber(level) == 0 or level == nil then
level = Obj.spell_level()
if level == 0 then
level = 1
end
if Obj.where() == 6 and Obj.spell_level() ~= 0 then
level = level + 1
end
else
level = tonumber(level)
end

local level = tonumber("0" .. text_dec(Logic.obj_par("spell_evilbook", "level"), level))
local kill = tonumber("0" .. text_dec(Logic.obj_par("spell_evilbook", "kill"), level))
local creator_power = 1 + tonumber(skill_power2("creator", 1)/100)
creator_power = creator_power/2
local int_bonus = 1 + tonumber(Game.Config("spell_power_config/int_power"))*HInt()/100
local item_bonus = tonumber(Logic.hero_lu_item("sp_spell_demonologist ", "count")/100)
local bonus = math.floor(100*(creator_power + item_bonus)*int_bonus)

return bonus, level, kill
end
Reply With Quote
  #4  
Old 10-31-2012, 09:30 AM
Bhruic Bhruic is offline
Approved Member
 
Join Date: Oct 2012
Posts: 233
Default

Nice find. Added that to the first post. Also added a fix for the Song of Svartalfheim.
Reply With Quote
  #5  
Old 10-31-2012, 03:57 PM
camelotcrusade's Avatar
camelotcrusade camelotcrusade is offline
Approved Member
 
Join Date: Apr 2009
Location: San Francisco, CA
Posts: 448
Default

Quote:
Originally Posted by Bhruic View Post
To save space I didn't quote the code, but you can go back and look... What it actually is doing is checking if you've got the item "alchemist_toolkit" equipped on your character, and if you do, then you have a 10% chance of getting a second bottle. That's the only way it lists for that to take place.

I've never used Alchemists/Engineers in WotN, so I'm not sure if they are supposed to have the option to mix more than one without an item.
I bet that is the problem - good find. I don't have that item so it's never creating 2 bottles. However, the description on remix clearly says "Create 1-2 charges of X." I guess they put that in as a catchall? Seems misleading if you ask me, especially since your chances of finding one specific item could be low.

Imo, it should always have that 10% chance and having the item (after all, it's a belt slot!) should give you an extra 10% chance. Either that or the description should say 1 item... but then it won't be accurate when you DO have that item. Aargh.

Thoughts?
Reply With Quote
  #6  
Old 10-31-2012, 04:19 PM
MattCaspermeyer MattCaspermeyer is offline
Approved Member
 
Join Date: Aug 2010
Posts: 553
Exclamation Try this...

Just do this:

Before:

Code:
  if Attack.act_human(0) then
    if Attack.act_name(0) == "alchemist" then
      if Logic.hero_lu_item_on_body("alchemist_toolkit") then
        if 10 >= Game.CurLocRand(1, 100) then
          charge = charge + 1
        end
      end
    end
  end
After:

Code:
  if Attack.act_human( 0 ) then
    if Attack.act_name( 0 ) == "alchemist" then
      local chance = 10

      if Logic.hero_lu_item_on_body( "alchemist_toolkit" ) then
        chance = chance + 10
      end

      if chance >= Game.CurLocRand( 1, 100 ) then
        charge = charge + 1
      end
    end
  end
The descriptions say 1 to 2 charges, but do not list a percent chance of that happening, the Toolkit description says +10% chance - the code above would cover both bases...

/C\/C\

Quote:
Originally Posted by camelotcrusade View Post
I bet that is the problem - good find. I don't have that item so it's never creating 2 bottles. However, the description on remix clearly says "Create 1-2 charges of X." I guess they put that in as a catchall? Seems misleading if you ask me, especially since your chances of finding one specific item could be low.

Imo, it should always have that 10% chance and having the item (after all, it's a belt slot!) should give you an extra 10% chance. Either that or the description should say 1 item... but then it won't be accurate when you DO have that item. Aargh.

Thoughts?
Reply With Quote
  #7  
Old 10-31-2012, 04:23 PM
camelotcrusade's Avatar
camelotcrusade camelotcrusade is offline
Approved Member
 
Join Date: Apr 2009
Location: San Francisco, CA
Posts: 448
Default

Thanks Matt! I'm going to mod my game and make a note of this on the bugs thread. Bhruic when you have time please add this to the summary. Also, thanks so much for tweaking Song of Alfheim. That one was complicated!

And I forget who linked me to the Crystal collector thread - I definitely know what's happening, I just think it's counter intuitive. Why on earth is there a reward for failing to learn your magic and hording up 100 crystals? Is it supposed to favor the Viking class or something? I find it a real killjoy and think it should be total collected. Mod for that would be great.
Reply With Quote
  #8  
Old 10-31-2012, 04:30 PM
Xargon Xargon is offline
Approved Member
 
Join Date: Nov 2008
Posts: 122
Default

Quote:
Originally Posted by camelotcrusade View Post
Thanks Matt! I'm going to mod my game and make a note of this on the bugs thread. Bhruic when you have time please add this to the summary. Also, thanks so much for tweaking Song of Alfheim. That one was complicated!

And I forget who linked me to the Crystal collector thread - I definitely know what's happening, I just think it's counter intuitive. Why on earth is there a reward for failing to learn your magic and hording up 100 crystals? Is it supposed to favor the Viking class or something? I find it a real killjoy and think it should be total collected. Mod for that would be great.
I agree about the crystal collector thing, it's rather annoying to hold off on all spell upgrades (though in line with the gold collector medal). But the required number of crystals should definitely higher if it is changed, a total of 100 collected crystals can be reached very early.
Reply With Quote
  #9  
Old 10-31-2012, 04:36 PM
camelotcrusade's Avatar
camelotcrusade camelotcrusade is offline
Approved Member
 
Join Date: Apr 2009
Location: San Francisco, CA
Posts: 448
Default

Quote:
Originally Posted by Xargon View Post
I agree about the crystal collector thing, it's rather annoying to hold off on all spell upgrades (though in line with the gold collector medal). But the required number of crystals should definitely higher if it is changed, a total of 100 collected crystals can be reached very early.
Hmm good point. We never noticed the problem with gold collector because gold is coming out our ears.

For me it's not even about holding out on upgrades, it's holding out on learning the magic in the first place. I just don't get rewarding us for not learning our spells in the first place. It would be like having an award for not spending your runes (I know the Rune Mage does that, but imo not the same thing) or an award for never using new troops. Is that supposed to be fun?

You know the more I think about it, the more messed up this is. It should be a reward for SPENDING your cyrstals and have a higher requirement. That would reward finding them and doing something useful. Maybe that is the Mod we should make, if it's possible.
Reply With Quote
  #10  
Old 10-31-2012, 06:22 PM
Loopy Loopy is offline
Approved Member
 
Join Date: Mar 2011
Posts: 71
Default

Pretty sure Crystal Collector isn't bugged. It's crystal collector, not crystal finder. If you are spending the crystals you aren't collecting them. The medal for getting lots of gold works the same way.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:58 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.