[b41] Class Pack 1.03

A place to post your add ons and ideas for them

Moderator: Moderator

Message
Author
daftigod
Archmage
Posts: 300
Joined: Fri Feb 18, 2011 6:15 am

Re: [b41] Class Pack 1.03

#16 Post by daftigod »

Updated to 1.03

Merged monk v4 and illusionist v17

have fun!

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: [b41] Class Pack 1.03

#17 Post by darkgod »

Took a look at the code; while you are superloading you are not inheriting the old code in most cases.
You should :)
If you need more hooks, request them :)
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

daftigod
Archmage
Posts: 300
Joined: Fri Feb 18, 2011 6:15 am

Re: [b41] Class Pack 1.03

#18 Post by daftigod »

Thanks DG, that's the exact kind of advice I need.

I noticed a few problems with default classes when the class-pack is activated, probably because of what you suggested in your post. For example: necromancers don't spawn with the create minions skill. (not sure why, since I didn't modify the spells.lua with the classpack). also, previously mentioned in this thread, the illusionist evasion skill (conflict) is used by non-illusionist npc's. This is because I superloaded the whole _M.act function with this: (added illusionist code at the end)

Code: Select all

-- Illusionist -
local base_act = _M.act
function _M:act()
	if not engine.Actor.act(self) then return end

	self.changed = true
	self.turn_procs = {}

	-- If resources are too low, disable sustains
	if self.mana < 1 or self.stamina < 1 or self.psi < 1 then
		for tid, _ in pairs(self.sustain_talents) do
			local t = self:getTalentFromId(tid)
			if (t.sustain_mana and self.mana < 1) or (t.sustain_stamina and self.stamina < 1 and not self:hasEffect(self.EFF_ADRENALINE_SURGE)) then
				self:forceUseTalent(tid, {ignore_energy=true})
			elseif (t.sustain_psi and self.psi < 1) and t.remove_on_zero then
				self:forceUseTalent(tid, {ignore_energy=true})
			end
		end
	end

	-- clear grappling
	if self:hasEffect(self.EFF_GRAPPLING) and self.stamina < 1 and not self:hasEffect(self.EFF_ADRENALINE_SURGE) then
		self:removeEffect(self.EFF_GRAPPLING)
	end

	-- disable spell sustains
	if self:attr("spell_failure") then
		for tid, _ in pairs(self.sustain_talents) do
			local t = self:getTalentFromId(tid)
			if t.is_spell and rng.percent(self:attr("spell_failure")/10)then
				self:forceUseTalent(tid, {ignore_energy=true})
				if not silent then game.logPlayer(self, "%s has been disrupted!", t.name) end
			end
		end
	end

	-- Conduit talent prevents all auras from cooling down
	if self:isTalentActive(self.T_CONDUIT) then
		local auras = self:isTalentActive(self.T_CONDUIT)
		if auras.k_aura_on then
			local t_kinetic_aura = self:getTalentFromId(self.T_KINETIC_AURA)
			self.talents_cd[self.T_KINETIC_AURA] = t_kinetic_aura.cooldown(self, t)
		end
		if auras.t_aura_on then
			local t_thermal_aura = self:getTalentFromId(self.T_THERMAL_AURA)
			self.talents_cd[self.T_THERMAL_AURA] = t_thermal_aura.cooldown(self, t)
		end
		if auras.c_aura_on then
			local t_charged_aura = self:getTalentFromId(self.T_CHARGED_AURA)
			self.talents_cd[self.T_CHARGED_AURA] = t_charged_aura.cooldown(self, t)
		end
	end

	if self:attr("paralyzed") then
		self.paralyzed_counter = (self.paralyzed_counter or 0) + (self:attr("stun_immune") or 0) * 100
		if self.paralyzed_counter < 100 then
			self.energy.value = 0
		else
			-- We are saved for this turn
			self.paralyzed_counter = self.paralyzed_counter - 100
			game.logSeen(self, "%s temporarily fights the paralyzation.", self.name:capitalize())
		end
	end
	if self:attr("stoned") then self.energy.value = 0 end
	if self:attr("dazed") then self.energy.value = 0 end
	if self:attr("time_stun") then self.energy.value = 0 end
	if self:attr("time_prison") then self.energy.value = 0 end

	-- Regain natural balance?
	local equilibrium_level = game.level.map:checkEntity(self.x, self.y, Map.TERRAIN, "equilibrium_level")
	if equilibrium_level then self:incEquilibrium(equilibrium_level) end

	-- Do stuff to things standing in the fire
	game.level.map:checkEntity(self.x, self.y, Map.TERRAIN, "on_stand", self)

	-- Still enough energy to act ?
	if self.energy.value < game.energy_to_act then return false end

	-- Still not dead ?
	if self.dead then return false end

	-- Ok reset the seen cache
	self:resetCanSeeCache()

	if self.on_act then self:on_act() end

	if self.never_act then return false end

	if not game.zone.wilderness and not self:attr("confused") and not self:attr("terrified") then self:automaticTalents() end

	-- Compute bonuses based on actors in FOV
	if self:knowTalent(self.T_MILITANT_MIND) and not self:hasEffect(self.EFF_MILITANT_MIND) then
		local nb_foes = 0
		local act
		for i = 1, #self.fov.actors_dist do
			act = self.fov.actors_dist[i]
			if act and self:reactionToward(act) < 0 and self:canSee(act) then nb_foes = nb_foes + 1 end
		end
		if nb_foes > 1 then
			nb_foes = math.min(nb_foes, 5)
			self:setEffect(self.EFF_MILITANT_MIND, 4, {power=self:getTalentLevel(self.T_MILITANT_MIND) * nb_foes * 0.6})
		end
	end

	-- Beckon (chance to move actor and consume energy)
	if self:hasEffect(self.EFF_BECKONED) then
		self.tempeffect_def[self.EFF_BECKONED].do_act(self, self:hasEffect(self.EFF_BECKONED))
	end
	-- Paranoid (chance to attack anyone nearby)
	if self:hasEffect(self.EFF_PARANOID) then
		self.tempeffect_def[self.EFF_PARANOID].do_act(self, self:hasEffect(self.EFF_PARANOID))
	end
	-- Panicked (chance to run away)
	if self:hasEffect(self.EFF_PANICKED) then
		self.tempeffect_def[self.EFF_PANICKED].do_act(self, self:hasEffect(self.EFF_PANICKED))
	end
-- CONFLICT CODE FOR ILLUSIONIST BEGIN
	if self:hasEffect(self.EFF_CONFLICT) then
		self.tempeffect_def[self.EFF_CONFLICT].do_act(self, self:hasEffect(self.EFF_CONFLICT))
	end
-- CONFLICT CODE FOR ILLUSIONIST END

	-- Still enough energy to act ?
	if self.energy.value < game.energy_to_act then return false end

	if self.sound_random and rng.chance(self.sound_random_chance or 15) then game:playSoundNear(self, self.sound_random) end

	return true
end
This is the whole _M.act function, with just the --Conflict code added in towards the end (exactly where ToxicChicken had intended it to be). I'm not sure how to trim this further to turn it into a hook. I'm not even sure what other lua files I need to be calling in order to do it. Finally, I don't know how to tell the engine to start at point A in the combat.lua, then add the code, then return to point B for the rest of combat code. Halp pleese :)

Kaballah
Cornac
Posts: 32
Joined: Sun Jul 22, 2012 10:36 pm

Re: [b41] Class Pack 1.03

#19 Post by Kaballah »

Hey, I'm working on a Skirmisher custom class and I realize that if I'm going to make it work the way I want it to, I'll need to superload the generic Archery attack as you're doing with this bundle. Of course that'd make it incompatible with this bundle, so ... when it's finished, could it be packaged with this?

Still up in the air is whether the changes I intend (allowing poisons, lethality and shadowstrike to work with archery) are overpowered.

daftigod
Archmage
Posts: 300
Joined: Fri Feb 18, 2011 6:15 am

Re: [b41] Class Pack 1.03

#20 Post by daftigod »

Absolutely Kaballah :)

Although you should probably look into making hooks and avoiding superloading like DG suggested. If all of the class addons used hooks then they would all be compatible with each other and any other addons that modify actor/archer/combat code.

I'm in the middle of moving again and don't have any time to work on the pack, but within a week or two things should be more stable and I'll start working on converting everything to hooks. Next version will include your Skirmisher and Faerie, and probably the MageKnight but I need to playtest everything to see how they feel. It looks like the Solopisist is going to make it into ToME, but if not I'll throw it in this pack too. I'm loving all of the community development lately! Of course, if anyone doesn't want their class in the pack, I will remove it. Probably should have said that awhile ago.

Anyways, if you have any luck with hooks, please point me in the right direction :)

Kaballah
Cornac
Posts: 32
Joined: Sun Jul 22, 2012 10:36 pm

Re: [b41] Class Pack 1.03

#21 Post by Kaballah »

I haven't the faintest idea of how to do this using hooks, while I've already got it in via modifying Archery.lua (it's just pasting in 1 block for poisons). I don't think I'm up to figuring out how to do another method, I'm really a terrible programmer. Just the Grenades custom tree I'm trying to do is very hard for me :/

On that note, where is documentation for crucial functions like project()? I'm trying to reverse engineer the parameters from looking at other code and it's making my head hurt. I've looked through the documentation on tome.org and there's a lot of game specific functions that aren't there.

Thanks though, I'll come back when it's all working.

bricks
Sher'Tul
Posts: 1262
Joined: Mon Jun 13, 2011 4:10 pm

Re: [b41] Class Pack 1.03

#22 Post by bricks »

Sorry about all the parentheses (sometimes I like to clarify things).

ne0pets22
Yeek
Posts: 11
Joined: Mon Jan 09, 2012 4:26 am

Re: [b41] Class Pack 1.03

#23 Post by ne0pets22 »

Why is this not in the game.

I still play b41 sometimes because of this mod. Any progress on porting to the RCs now that there's a feature freeze and all?

Dekar
Spiderkin
Posts: 559
Joined: Wed Jan 26, 2011 3:47 pm

Re: [b41] Class Pack 1.03

#24 Post by Dekar »

If you want to update your pack, I significantly cleaned up the code of my ranger in prepration for some big changes.
Its for b43 and all that is left to do is in the superload of Actor.lua to look for "--base_postUseTalent(self, ab, ret)" ,uncomment it, remove everything above it until and including "if not ret then return end" and then adding the flag for not breaking reloading to all talents that are Commands in the talent file.
With these changes it should be compatible with all newer versions of ToME.

And feel free to change the name of the class back to Ranger. :o

And if you dont plan to update the pack its ok too, no pressure from my side. :D
Attachments
ranger.zip
Code!
(69.25 KiB) Downloaded 250 times

daftigod
Archmage
Posts: 300
Joined: Fri Feb 18, 2011 6:15 am

Re: [b41] Class Pack 1.03

#25 Post by daftigod »

wow, that's a great thing to hear!

what do we have for new playable classes at this point? off the top of my head we have a new race - wights; and also the werebeast, mage knight (long over due to be put in the pack!), skirmisher, elementalist, gardener, and the unfinished but WICKED promising blue mage. what am I forgetting?

i'll try to load up the old pack into rc2 to see what's broken and stuff like that. there's still alot of old superload stuff that needs to be converted to hooks if we want to do a new version.

anyways, i've been thinking about this for awhile and wouldn't mind working as a team for the next class pack! is anyone interested in setting up a page on git or something? feel free to put class pack 1.0.3 up there in it's entirety, as long as the authors don't object, I have no problem with that :)

edit - hell yeah Dekar!

ne0pets22
Yeek
Posts: 11
Joined: Mon Jan 09, 2012 4:26 am

Re: [b41] Class Pack 1.03

#26 Post by ne0pets22 »

Lua goes completely over my head, but a github page I can do. Imma edit this when I put it up.

EDIT: Heyyy, I can kinda guess at the lua class features. Hurray for transferrable skills! I'll merge the ranger class too then.

EDIT: https://github.com/Davidy22/classPack. I didn't do the merge, too busy wrestling with git. User-friendly my ***.

Sradac
Sher'Tul
Posts: 1081
Joined: Fri Sep 21, 2007 3:18 am
Location: Angolwen

Re: [b41] Class Pack 1.03

#27 Post by Sradac »

Alchemist+ was nice, along with elementalist is the Archmage tweaks in that mod, i think that might be it?

ne0pets22
Yeek
Posts: 11
Joined: Mon Jan 09, 2012 4:26 am

Re: [b41] Class Pack 1.03

#28 Post by ne0pets22 »

Dekar wrote:If you want to update your pack, I significantly cleaned up the code of my ranger in prepration for some big changes.
Its for b43 and all that is left to do is in the superload of Actor.lua to look for "--base_postUseTalent(self, ab, ret)" ,uncomment it, remove everything above it until and including "if not ret then return end" and then adding the flag for not breaking reloading to all talents that are Commands in the talent file.
With these changes it should be compatible with all newer versions of ToME.

And feel free to change the name of the class back to Ranger. :o

And if you dont plan to update the pack its ok too, no pressure from my side. :D
Done and merged. Tell me if I messed up anywhere, still not quite comfortable with lua. I like curly brackets.

Dekar
Spiderkin
Posts: 559
Joined: Wed Jan 26, 2011 3:47 pm

Re: [b41] Class Pack 1.03

#29 Post by Dekar »

All Commands still need "no_reload_break = true" added.
Then it might be fine.

ne0pets22
Yeek
Posts: 11
Joined: Mon Jan 09, 2012 4:26 am

Re: [b41] Class Pack 1.03

#30 Post by ne0pets22 »

Dekar wrote:All Commands still need "no_reload_break = true" added.
Then it might be fine.
Done and done:
https://github.com/Davidy22/classPack

Shame it doesn't work in the latest ToME quite yet, what with the other classes in there and all. Getting there though. Feel free to push commits to the repo yourself, I set it to read-write public.

Also, that actors.lua file is *massive*. It'd make it quite a bit easier to manage if we put a bunch of load statements in there, then split the code for each class into separate files. Also reading the lua docs, because there is no way I can continue working on this if I don't know the language.

Post Reply