Help me make my new variant! (please!)
Collapse
X
-
Will_Asher
aka LibraryAdventurer
My old variant DaJAngband:
http://sites.google.com/site/dajangbandwebsite/home (defunct and so old it's forked from Angband 3.1.0 -I think- but it's probably playable...) -
I'm looking at calc_bonuses() and I'm a little confused about which stat array holds the actual stat number shown on the status line. Is it state->stat_use[] or state->stat_ind[] ?
And under "/* Calculate the various stat values */",
why does "ind = (use - 3);"? (Why is 3 subtracted from it?)Will_Asher
aka LibraryAdventurer
My old variant DaJAngband:
http://sites.google.com/site/dajangbandwebsite/home (defunct and so old it's forked from Angband 3.1.0 -I think- but it's probably playable...)Comment
-
I'm looking at calc_bonuses() and I'm a little confused about which stat array holds the actual stat number shown on the status line. Is it state->stat_use[] or state->stat_ind[] ?
And under "/* Calculate the various stat values */",
why does "ind = (use - 3);"? (Why is 3 subtracted from it?)Comment
-
cool, thanksWill_Asher
aka LibraryAdventurer
My old variant DaJAngband:
http://sites.google.com/site/dajangbandwebsite/home (defunct and so old it's forked from Angband 3.1.0 -I think- but it's probably playable...)Comment
-
trying to add a heaviness curse, but I can't find where it actually applies the curse effect to an object.
I have this in object-init.c
Code:static enum parser_error parse_curse_combat(struct parser *p) { struct curse *curse = parser_priv(p); assert(curse); curse->obj->to_h = parser_getint(p, "to-h"); curse->obj->to_d = parser_getint(p, "to-d"); curse->obj->to_a = parser_getint(p, "to-a"); curse->obj->weight = parser_getint(p, "weight"); return PARSE_ERROR_NONE; }
I looked through obj-curse.c, but it never seems to look at the curse->obj->to_h(etc). The curse struct declared in object.h doesn't even have a place for to_h/to_d/to_a. Where does the code apply these things to an object?Will_Asher
aka LibraryAdventurer
My old variant DaJAngband:
http://sites.google.com/site/dajangbandwebsite/home (defunct and so old it's forked from Angband 3.1.0 -I think- but it's probably playable...)Comment
-
Code:struct object *obj;
Code:/* Analyze equipment */ for (i = 0; i < p->body.count; i++) { int index = 0; struct object *obj = slot_object(p, i); struct curse_data *curse = obj ? obj->curses : NULL; while (obj) {
Code:/* Apply combat bonuses */ state->ac += obj->ac; if (!known_only || obj->known->to_a) state->to_a += obj->to_a; if (!slot_type_is(p, i, EQUIP_WEAPON) && !slot_type_is(p, i, EQUIP_BOW)) { if (!known_only || obj->known->to_h) { state->to_h += obj->to_h; } if (!known_only || obj->known->to_d) { state->to_d += obj->to_d; } }
Code:/* Move to any unprocessed curse object */ if (curse) { index++; obj = NULL; while (index < z_info->curse_max) { if (curse[index].power) { obj = curses[index].obj; break; } else { index++; } } } else { obj = NULL; }
Heaviness curse is a nice idea, BTW, I will probably steal it back from youOne for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.Comment
-
EDIT: So the curses don't modify the object at all. They just modify the player while the object is being worm/wielded. That's going to make it hard to do a heaviness curse, especially for thrown weapons...
PS: here's the entry for curse.txt:
name:heaviness
combat:-4:4:0:100 (the 4th spot here is for weight, so it adds up to 10lbs)
values: DEX[-2]
type:hafted
type: polearm
type:sword
type:bow
type:throwing weapon
type:boots
type:shield
type:hard armor
type:dragon armor
desc:weighs you down
I also added a lightness ego.Last edited by will_asher; August 21, 2021, 04:52.Will_Asher
aka LibraryAdventurer
My old variant DaJAngband:
http://sites.google.com/site/dajangbandwebsite/home (defunct and so old it's forked from Angband 3.1.0 -I think- but it's probably playable...)Comment
-
It looks like this is actually a bit of work. The way I would do it is:- Add a function (probably in obj-util.c) called something like object_weight(). This should take a struct object * argument, and should take the object's actual weight and then run through all the curses on the object add weight whenever a curse has weight, and return the total.
- Then search though for all uses of object weight in calculations or display, and replace obj->weight with object_weight(obj).
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.Comment
-
In this line:
int player_noise = 1 << (30 - stealth);
what does the "<<" mean?Will_Asher
aka LibraryAdventurer
My old variant DaJAngband:
http://sites.google.com/site/dajangbandwebsite/home (defunct and so old it's forked from Angband 3.1.0 -I think- but it's probably playable...)Comment
-
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.Comment
-
Sorry, it's been a long time since I had any math(s) class. "by a power of 2" sounds to me like "squared" but 1 squared is still 1 so how does 1 << 1 = 2?, and I don't know what you mean by "shifting bits to the left" (unless it's multiplying by 10 which it obviously isn't). I still don't get it...Will_Asher
aka LibraryAdventurer
My old variant DaJAngband:
http://sites.google.com/site/dajangbandwebsite/home (defunct and so old it's forked from Angband 3.1.0 -I think- but it's probably playable...)Comment
-
Sorry, it's been a long time since I had any math(s) class. "by a power of 2" sounds to me like "squared" but 1 squared is still 1 so how does 1 << 1 = 2?, and I don't know what you mean by "shifting bits to the left" (unless it's multiplying by 10 which it obviously isn't). I still don't get it...One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.Comment
-
Sorry, it's been a long time since I had any math(s) class. "by a power of 2" sounds to me like "squared" but 1 squared is still 1 so how does 1 << 1 = 2?, and I don't know what you mean by "shifting bits to the left" (unless it's multiplying by 10 which it obviously isn't). I still don't get it...
An example with 8 bits (most significant (biggest) first):
00000101 = 1 * 2^2 + 1 * 2^0 = 4 + 1 = 5
Shifted by 1 bit to the left:
00001010 = 1 * 2^3 + 1 * 2^1 = 8 + 2 = 10 = 5 * 2
Shifted by 2 bits to the left:
00010100 = 1 * 2^4 + 1 * 2^2 = 16 + 4 = 20 = 5 * 4
This is analogous to multiplying by 10 when a number is written in decimal notation. However, for binary each digit represents a power of 2 rather than a power of 10, so shifting multiplies (or divides) by 2 rather than by 10.Comment
-
Okay, I see.
Now, I'm wondering why the stealth code uses this weird formula...Will_Asher
aka LibraryAdventurer
My old variant DaJAngband:
http://sites.google.com/site/dajangbandwebsite/home (defunct and so old it's forked from Angband 3.1.0 -I think- but it's probably playable...)Comment
Comment