Fate Meta-Class: Subclasses: Wyrdthief, Oracle, Champion

All new ideas for the upcoming releases of ToME 4.x.x should be discussed here

Moderator: Moderator

Message
Author
nate
Wyrmic
Posts: 261
Joined: Fri Jan 18, 2013 8:35 am

Re: Fate Meta-Class: Subclasses: Wyrdthief, Oracle, Champion

#61 Post by nate »

Fayd, I'd be happy to build some framework for you. Class talents like this wouldn't be very hard for me. It might be easier for you to tweak existing code than to build it from scratch. If so, let me know.
Proud father of Fx4fx and Chronometer add-ons; proud mother of Fated add-on

Fayd
Halfling
Posts: 85
Joined: Wed Feb 06, 2013 6:04 pm

Re: Fate Meta-Class: Subclasses: Wyrdthief, Oracle, Champion

#62 Post by Fayd »

I sent you a PM to this effect, but I think I'd like to take you up on your offer.

Fayd
Halfling
Posts: 85
Joined: Wed Feb 06, 2013 6:04 pm

Re: Fate Meta-Class: Subclasses: Wyrdthief, Oracle, Champion

#63 Post by Fayd »

Nate and I are working on the code, but we hit a bit of a wall for getting the player's stats, specifically the Luck stat. Also how to make the game update character stats based upon the current level of a particular resource.

stinkstink
Spiderkin
Posts: 543
Joined: Sat Feb 11, 2012 1:12 am

Re: Fate Meta-Class: Subclasses: Wyrdthief, Oracle, Champion

#64 Post by stinkstink »

Fayd wrote:Nate and I are working on the code, but we hit a bit of a wall for getting the player's stats, specifically the Luck stat.
Get stats with getStr(), getLck(), etc methods. You'll use self:getLck() and such in most talents. There's documentation on the arguments you can pass to the getStat function.
Fayd wrote:Also how to make the game update character stats based upon the current level of a particular resource.
Here's an example:

You'll want to update the stats every game turn and whenever they use a talent, so in hooks/load.lua:

Code: Select all

local class = require"engine.class"
local ActorTalents = require "engine.interface.ActorTalents"

--runs every 10 game ticks
class:bindHook("Actor:actBase:Effects", function(self, data)
	if self:knowTalent(ActorTalents.T_YOURTALENT) then
		local t = self:getTalentFromId(ActorTalents.T_YOURTALENT)
		t.updatestats(self, t) end
end)

--runs whenever an actor uses a talent
class:bindHook("Actor:actBase:Effects", function(self, data)
	if self:knowTalent(ActorTalents.T_YOURTALENT) then
		local t = self:getTalentFromId(ActorTalents.T_YOURTALENT)
		t.updatestats(self, t) end
end)
in the talent table for YOURTALENT

Code: Select all

updatestats = function(self, t)
		self:removeTemporaryValue("inc_stats", self.statboost)
		local boost = math.ceil(self.yourresource / self.max_yourresource * 10)
		self.statboosts = self:addTemporaryValue("inc_stats",
			{
				[Stats.STAT_STR] = boost,
				[Stats.STAT_DEX] = boost,
				[Stats.STAT_MAG] = boost,
				[Stats.STAT_WIL] = boost,
				[Stats.STAT_CUN] = boost,
				[Stats.STAT_CON] = boost,
				[Stats.STAT_LCK] = boost,
			})
	return true
end,
Here, you're attaching a temporary effect to a global variable called statboost on to whoever is calling that function. You'll want self:removeTemporaryValue("inc_stats", self.statboost) in the talent's on_unlearn function as well.

nate
Wyrmic
Posts: 261
Joined: Fri Jan 18, 2013 8:35 am

Re: Fate Meta-Class: Subclasses: Wyrdthief, Oracle, Champion

#65 Post by nate »

I'm pounding my way through :)

Not a fan of how all of this code is set up though. A hundred different ways to do things, and none of them obvious, and none of the functions penetrable. What's your luck? Why, it's the seventh field of stats. Not stats.luck, but stats[7]. Or getStat(7). Or getLck, but where is that function defined? I can't find it. How do I change luck? Not with setLck, not even with setStat(7). With addTemporaryValue("inc_stats", { [(require "engine.interface.ActorStats").STAT_LCK] = -5 }) of course. Big fan of that argument? I'm not. And if I wanted to parse addTemporaryValue to figure it out, then I'm totally out of luck, because that function was written by R2D2. Or maybe with attr, which is at least parseable, even I can't figure out a reason for its existence-- it's really not hard to write self[prop] = (self[prop] or 0) + v, not any harder than it is to write self:attr(prop, v), and at least the former is comprehensible without tearing through the Remembrance of Things Past that is ToME source.

Pardon my rant, trying to parse this shit is really irritating. I'm sure there are reasons for all of this to be the way it is, but those reasons are not readily apparent to me, and I imagine most of you that have tried to do the same can sympathize with my frustration, even should it be misplaced.
Proud father of Fx4fx and Chronometer add-ons; proud mother of Fated add-on

HousePet
Perspiring Physicist
Posts: 6215
Joined: Sun Sep 09, 2012 7:43 am

Re: Fate Meta-Class: Subclasses: Wyrdthief, Oracle, Champion

#66 Post by HousePet »

If you can't find some functions, they are either in the engine or the engine writes the functions itself.

Its a little bit confusing, but some of the code writes itself....
My feedback meter decays into coding. Give me feedback and I make mods.

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

Re: Fate Meta-Class: Subclasses: Wyrdthief, Oracle, Champion

#67 Post by darkgod »

Which is the case, the engine creates get getXXX function for stats on the fly as you define stats.
You never need to know the numerical id of a stat; actor.STAT_LCK always works
You can increase stats with
actor:incStat(actor.STAT_LCK, X)
or
actor:incIncStat(actor.STAT_LCK, X)

The first increases the base stat (cant go beyond the limit), the second increases the bonus (like an item would)
[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 ;)

nate
Wyrmic
Posts: 261
Joined: Fri Jan 18, 2013 8:35 am

Re: Fate Meta-Class: Subclasses: Wyrdthief, Oracle, Champion

#68 Post by nate »

It's okay, got what is hopefully the hard first part done, sent off to Fayd for refinement, although I do appreciate the comments about various ways to do things-- both because my occasional local luck = 7; getStat(luck) is bad form, and because I'd prefer intercepting functions (think onStatChange()) to checking variables at timed intervals, which is a bit of a kludge.

I figured there was generated code; I just don't think generated functions are appropriate in this situation.
Proud father of Fx4fx and Chronometer add-ons; proud mother of Fated add-on

Fayd
Halfling
Posts: 85
Joined: Wed Feb 06, 2013 6:04 pm

Re: Fate Meta-Class: Subclasses: Wyrdthief, Oracle, Champion

#69 Post by Fayd »

Progress update: Nate is fantastic; he's gotten almost all of the trees for Wyrdthieves completed. At the moment, they won't have any Card based skills to make life easier for nate and myself. I'm working on getting some rudimentary talent images in place, and will begin testing and tweaking things soon in preparation for a larger release.

Umbrall
Thalore
Posts: 153
Joined: Sat Feb 23, 2013 7:53 pm

Re: Fate Meta-Class: Subclasses: Wyrdthief, Oracle, Champion

#70 Post by Umbrall »

I'm going to say that especially because you're making this now, please fix the resource issue. It's really awkward. Imagine a buff says that it grants you +luck. Does that mean it gives you a luck resource, increases your luck, increases your luck and then decreases it at the end, what? Personally I would make it a separate resource from -100 to 100 called something else (I've seen fate and karma as suggestions, the latter i really prefer). It isn't affected by your luck stat but instead modifies your luck as a multiplier of it (not too much). Skills scale off of luck along with an additional stat. Certain skills could scale off of unluck (i.e. 50 - luck)

Fayd
Halfling
Posts: 85
Joined: Wed Feb 06, 2013 6:04 pm

Re: Fate Meta-Class: Subclasses: Wyrdthief, Oracle, Champion

#71 Post by Fayd »

It is already fixed, no worries. When I took a look at the code it was dramatically easier to make a new resource than to tr to co-opt something that already existed. The resource is called "Fortune." It still scales with luck and given investment can be mechanically equal to Luck, but they are separate and distinct.

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

Re: Fate Meta-Class: Subclasses: Wyrdthief, Oracle, Champion

#72 Post by darkgod »

Yay sounds fun !
[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 ;)

Fayd
Halfling
Posts: 85
Joined: Wed Feb 06, 2013 6:04 pm

Re: Fate Meta-Class: Subclasses: Wyrdthief, Oracle, Champion

#73 Post by Fayd »

One... Question. I'm looking to test the code, but... I don't actually know how to make the zip a .teaa. I've tried renaming it but that doesn't seem to work, and there is no clear process outlined on the wiki or somewhere else I could find easily.

nate
Wyrmic
Posts: 261
Joined: Fri Jan 18, 2013 8:35 am

Re: Fate Meta-Class: Subclasses: Wyrdthief, Oracle, Champion

#74 Post by nate »

lol fayd, check PM
Proud father of Fx4fx and Chronometer add-ons; proud mother of Fated add-on

Fayd
Halfling
Posts: 85
Joined: Wed Feb 06, 2013 6:04 pm

Re: Fate Meta-Class: Subclasses: Wyrdthief, Oracle, Champion

#75 Post by Fayd »

Thanks nate!

So, by way of news: The last two main talent trees have been sent to nate for construction.

Post Reply