TomeNET skill builder v2.0

Discussion about topics that don't fit elsewhere.
Lightman
Posts: 165
Joined: Thu Jun 07, 2012 7:55 pm

Re: TomeNET skill builder v2.0

Post by Lightman »

The spell advert function needs to be modified to handle shared spells.

function get_spell_advert(sspell) {
var school=SPELL[sspell][1];
if (school.split("-").length==2)
{
var school1=school.split('-')[0];
var school2=school.split('-')[1]
var level1=Math.floor(v(school1)/1000);
var level2=Math.floor(v(school2)/1000);
var level=Math.floor((level1+level2)/2)-1;
if (level<=0) return '';
return sspell+' ('+(level)+') <br/>';
}
if (school.split("-").length==3)
{
var school1=school.split('-')[0];
var school2=school.split('-')[1]
var school3=school.split('-')[2]
var level1=Math.floor(v(school1)/1000);
var level2=Math.floor(v(school2)/1000);
var level3=Math.floor(v(school3)/1000);
var level=Math.floor((level1+level2+level3)/3)-1;
if (level<=0) return '';
return sspell+' ('+(level)+') <br/>';
}
var school=SPELL[sspell][1];
var level=Math.floor(get_spell_level(sspell)/1000);
level=Math.floor(1+level-SPELL[sspell][0]);
if (level <= 0) return '';
return sspell+' ('+ Math.floor(level * spell_power(sspell)) +') <br/>';
}
Lightman
Posts: 165
Joined: Thu Jun 07, 2012 7:55 pm

Re: TomeNET skill builder v2.0

Post by Lightman »

if you are interested, I ran this macro in Excel to rip out the spell data. You need to enter your path for the .lua files.


Option Explicit

Sub RipSpells()

Dim fs As FileSystemObject
Dim fol As Folder
Dim fil As File
Dim stream As TextStream
Dim rownum As Long
Dim spell As String
Dim school As String
Dim level As String
Dim path As String
rownum = 1
path = InputBox("Enter path for tomenet luas", "Path required", "C:\TomeNET\lib\scpt")
Set fs = New FileSystemObject
Set fol = fs.GetFolder(path)
For Each fil In fol.Files
Set stream = fil.OpenAsTextStream
Do While Not stream.AtEndOfStream
Cells(rownum, 2) = stream.ReadLine
rownum = rownum + 1
Loop
Next

rownum = 1
Do While rownum < 12000
If InStr(Cells(rownum, 2).text, "add_spell") > 0 Then
Do While rownum < 12000 And InStr(Cells(rownum, 2).text, "name") = 0
rownum = rownum + 1
Loop
spell = Cells(rownum, 2).text
spell = asciiRange(spell)
spell = Replace(spell, """name""", "")
spell = Replace(spell, "=", "")
spell = Replace(spell, "add_spell", "")
spell = Replace(spell, "{", "")
spell = Replace(spell, "[]", "")
spell = Replace(spell, ",", "")
spell = Replace(spell, """", "")
spell = Replace(spell, "'", "")
spell = Trim(spell)
Do While rownum < 12000 And InStr(Cells(rownum, 2).text, "school") = 0
rownum = rownum + 1
Loop
school = Cells(rownum, 2).text
school = asciiRange(school)
school = Replace(school, """school""", "")
school = Replace(school, "SCHOOL_", "")
school = Replace(school, "=", "")
school = Replace(school, "[]", "")
school = Replace(school, "-- ", "")
school = Trim(school)
school = Replace(school, ",", "")
school = Replace(school, """", "")
school = Replace(school, "-", "")
school = Replace(school, " ", "-")
school = Replace(school, "'", "")
Do While rownum < 12000 And InStr(Cells(rownum, 2).text, "level") = 0
rownum = rownum + 1
Loop
level = Cells(rownum, 2).text
level = asciiRange(level)
level = Replace(level, """level""", "")
level = Replace(level, "=", "")
level = Replace(level, "[]", "")
level = Replace(level, ",", "")
level = Replace(level, """", "")
level = Replace(level, "-- ", "")
level = Replace(level, "--", "")
level = Trim(level)
Dim entry As String
entry = "SPELL['" + school + "." + spell + "']=[" + level + ", '" + school + "'];"
entry = asciiRange(entry)
Cells(rownum, 1) = entry
Cells(rownum, 3) = school
End If
rownum = rownum + 1
Loop

Columns("A:C").Select
Range("C1").Activate
ActiveWorkbook.Worksheets("Sheet2").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet2").Sort.SortFields.Add Key:=Range( _
"C1:C10375"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Sheet2").Sort
.SetRange Range("A1:C10375")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With

Columns("B:C").Select
Selection.Delete Shift:=xlToLeft
End Sub

Private Function asciiRange(ret As String)
Dim text As String
Dim col As Long
Dim car As String
text = ""
For col = 1 To Len(ret)
car = Mid(ret, col, 1)
If Asc(car) > 31 And Asc(car) < Asc("z") Then
text = text + car
End If
Next
asciiRange = text
End Function
User avatar
the_sandman
Developer
Posts: 150
Joined: Sun Dec 13, 2009 6:52 pm

Re: TomeNET skill builder v2.0

Post by the_sandman »

Very much appreciated, Lightman. Spells are updated now.
User avatar
PowerWyrm
Posts: 241
Joined: Sat Jan 09, 2010 4:28 pm

Re: TomeNET skill builder v2.0

Post by PowerWyrm »

Maia holy/unholy spells don't seem to be correctly handled. For example, a shaman starts with a base Shadow skill of 0.900, which for neutral Maia is multiplied by 0.7 (0.630). When the character reaches level 20 and becomes corrupted, a 2.1x factor is applied to the starting skill: 0.630 x 2.1 = 1.323. The skill builder considers that the multiplier is applied to the base skill and uses 0.900 x 2.1 = 1.890 instead.
User avatar
the_sandman
Developer
Posts: 150
Joined: Sun Dec 13, 2009 6:52 pm

Re: TomeNET skill builder v2.0

Post by the_sandman »

PowerWyrm wrote:Maia holy/unholy spells don't seem to be correctly handled. For example, a shaman starts with a base Shadow skill of 0.900, which for neutral Maia is multiplied by 0.7 (0.630). When the character reaches level 20 and becomes corrupted, a 2.1x factor is applied to the starting skill: 0.630 x 2.1 = 1.323. The skill builder considers that the multiplier is applied to the base skill and uses 0.900 x 2.1 = 1.890 instead.
Thanks; it should be fixed now. It was happening to holy schools too, which was weird.
User avatar
the_sandman
Developer
Posts: 150
Joined: Sun Dec 13, 2009 6:52 pm

Re: TomeNET skill builder v2.0

Post by the_sandman »

Updaterino (shaman lost mana, shadow lost fog)
User avatar
tangar
Posts: 1652
Joined: Tue Mar 03, 2015 3:49 pm
Contact:

Re: TomeNET skill builder v2.0

Post by tangar »

Vampire exp is 270% :(
Tangar's tileset, addon, guides & maps: English TomeNET page ||||||| Russian TomeNet page
http://youtube.com/GameGlaz — streams in English // http://youtube.com/StreamGuild — streams in Russian
My chars @ angband.oook.cz
ArtDrake
Posts: 5
Joined: Tue Jun 06, 2017 9:14 am

Re: TomeNET skill builder v2.0

Post by ArtDrake »

So, I've performed a wide variety of minor fixes and updates to the Skill Builder, with the result in the linked files below:

https://www.dropbox.com/s/fmzfzqvzgyr5m ... r.php?dl=0
https://www.dropbox.com/s/2pa8qj72heexp ... ls.js?dl=0

You might want to compare them side-by-side in a tool that can highlight differences between versions (like a git client), to keep what you want to keep, but I was quite confident about all the changes I did make (except maybe the addition of the stealth bonus tiers for Shadow school).

Suggested next feature: dynamically changing the dropdown lists depending on which classes a race has access to, and possibly vice versa. There's a tradeoff where it becomes a little harder to navigate, but it'd make it a lot clearer which races could have which classes, especially with the advent of the three newish single-race classes. The other option in a similar vein would be, when selecting a race, if the current class is forbidden, automatically skip to an allowed class, and vice versa, so that no illegal combinations can actually be skill-built, but navigation isn't impeded.

Oh, and Tangar? I think it's actually the Guide that's wrong on this one; I checked tables.c, and it says 220.

Changelog:
- Updated the HTML side to include options for the Hell Knight and the Corrupted Priest.
- Changed MAX_CLASS to account for the two additional classes.
- Updated the "friendlies" -- included Hereticism in the skill interdependencies, fixed a mistake regarding Archery, and added Blood Magic, whose dependencies were missing.
- Added Hell Knight and Corrupted Priest to the class list.
- Added all Hereticism spells to the spell lists, using the most current luas.
- Added CLASS_HELLKNIGHT and CLASS_CPRIEST to initialize_pclass().
- Added all occult school boni to summarize(). Also corrected numerous mistakes and inclarities in summarize(), expanding and updating it to include more recent boni. For instance, changed language regarding MA bonuses that referred to the FF bonus as "levitation", and added immunity to life-draining effects at Necromancy 50.
- Added Death Knight, Hell Knight, and Corrupted Priest entries to get_class_advert(), though if these are taken from game files, I couldn't find them -- I just modified the Paladin and Priest adverts appropriately.
- Removed the holy schools from spell_power(); they're not affected. This inconsistency has been here for years.
- Removed a mistake resulting in an off-by-one shift in the class stat bonuses.
- Removed a reference to Paladins using MA, which is not accurate at present.
- Oops. Removed Divination and Conveyance from Corrupted Priest skills -- I didn't notice those were commented out.
User avatar
the_sandman
Developer
Posts: 150
Joined: Sun Dec 13, 2009 6:52 pm

Re: TomeNET skill builder v2.0

Post by the_sandman »

Hi ArtDrake, thanks.

The following were absorbed:

- new class summary description
- new class definitions
- friendly skills relationships
- spellpower schools update (removed H*)-- indeed long overdue.
- (new and updates to previous) skills bonuses
- stats modifiers to the recent classes

As you know it's near impossible to manually and correctly parse tables.c. Huge thanks again to Lightman for the spell lua scrubber. (I don't run them as often as I should) Out of necessity, I had to ignore the following.
- spells info
- race/class skills mods

If you're interested, this is the file that generates the javascript. (see: tableparser.pl from https://github.com/airawan/misc) It can parse stripped tables.c directly (see: generate_skills.js.sh)-- I usually edit this and never the javascript directly.

old response:

Code: Select all

Thanks, I'll take a look. 

FYI I don't have static .js files; it's all perl scripts that will inject the changes and generate a .js file. Less tedious (sometimes).

I'll merge the changes and will update the repo eventually (@https://github.com/airawan/misc)

I have been thinking of taking out the spells info into another tool, so it is independent of the skills builder, but maybe people do enjoy having them both at one place.
ArtDrake
Posts: 5
Joined: Tue Jun 06, 2017 9:14 am

Re: TomeNET skill builder v2.0

Post by ArtDrake »

Ah! Wonderful. I'm excited to see the new material incorporated. And I'll definitely be poking around in the scripts you linked me.

Just to make sure I understand, some changes couldn't be incorporated because while the HTML and the JS would have been fine in isolation, probably, changes need to happen at the level above, so modifying a particular JS file isn't particularly useful on that front? And then, follow-up question: would it be possible for me to contribute a Hereticism update to that at some point?

[As always, one or two mistakes slip by that you only notice moments after they're pubished -- in particular, reference to Corrupted Priests having Divination and Conveyance remains in the new class advert I wrote. Best if both instances ("plus some Divination and Conveyance", "Bonus on Conveyance") were deleted.]
Post Reply