Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old July 31, 2021, 00:26   #151
will_asher
DaJAngband Maintainer
 
will_asher's Avatar
 
Join Date: Apr 2007
Location: San Antonio, TX
Posts: 1,124
Donated: $10
will_asher is on a distinguished road
Quote:
Originally Posted by backwardsEric View Post
There was the problem you reported with flasks of oil multiplying, I believe that was addressed in https://github.com/angband/angband/pull/4671 . It's taken several sets of changes to get the handling of thrown weapons in the quiver to its current state. In order from first to last they were (the key files are obj-gear.c and player-calcs.c (for calc_inventory()):
  1. https://github.com/angband/angband/c...0afb42d95943f2
  2. https://github.com/angband/angband/pull/4613
  3. https://github.com/angband/angband/c...d95d01d83141e2
  4. https://github.com/angband/angband/c...d95d01d83141e2
  5. https://github.com/angband/angband/c...d95d01d83141e2
  6. https://github.com/angband/angband/pull/4671
  7. https://github.com/angband/angband/c...d95d01d83141e2
  8. https://github.com/angband/angband/pull/4769
Thanks that'll help
__________________
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...)
will_asher is offline   Reply With Quote
Old August 8, 2021, 06:32   #152
will_asher
DaJAngband Maintainer
 
will_asher's Avatar
 
Join Date: Apr 2007
Location: San Antonio, TX
Posts: 1,124
Donated: $10
will_asher is on a distinguished road
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...)
will_asher is offline   Reply With Quote
Old August 8, 2021, 11:37   #153
backwardsEric
Adept
 
Join Date: Aug 2019
Posts: 221
backwardsEric is on a distinguished road
Quote:
Originally Posted by will_asher View Post
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?)
It's stat_use (code in ui-display.c displays the panel next to the map with the stats; code in ui-player.c displays the character sheet). stat_ind has a converted range: rather than the 3 - 18/220 range (encoded as 3 - 18 for 3 to 18 and 18 plus the excess for an over 18 stat) it uses a range of 0 (thus the subtraction of 3) to 37 for easier lookup into tables for things that depend on a stat (weight allowance, adjustment to device skill, ...).
backwardsEric is offline   Reply With Quote
Old August 8, 2021, 21:03   #154
will_asher
DaJAngband Maintainer
 
will_asher's Avatar
 
Join Date: Apr 2007
Location: San Antonio, TX
Posts: 1,124
Donated: $10
will_asher is on a distinguished road
cool, thanks
__________________
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...)
will_asher is offline   Reply With Quote
Old August 21, 2021, 04:39   #155
will_asher
DaJAngband Maintainer
 
will_asher's Avatar
 
Join Date: Apr 2007
Location: San Antonio, TX
Posts: 1,124
Donated: $10
will_asher is on a distinguished road
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;
}
but curse->obj->to_a, to_h and to_d don't seem to be used anywhere else in the code.
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...)
will_asher is offline   Reply With Quote
Old August 21, 2021, 05:14   #156
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 56
Posts: 9,173
Donated: $60
Nick will become famous soon enoughNick will become famous soon enough
Quote:
Originally Posted by will_asher View Post
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?
The trick is that struct curse has a field
Code:
struct object *obj;
which holds all that information. This is then applied in calc_bonuses(), in the loop starting with
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) {
with combat bonuses being applied here:
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;
				}
			}
The original object is handled first, then any curse objects, with the iteration through them being handled here:
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;
			}
So in addition to your change in obj-init.c, you need to handle weight in that combat bonuses section.

Heaviness curse is a nice idea, BTW, I will probably steal it back from you
__________________
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
Nick is offline   Reply With Quote
Old August 21, 2021, 05:31   #157
will_asher
DaJAngband Maintainer
 
will_asher's Avatar
 
Join Date: Apr 2007
Location: San Antonio, TX
Posts: 1,124
Donated: $10
will_asher is on a distinguished road
Quote:
Originally Posted by Nick View Post
So in addition to your change in obj-init.c, you need to handle weight in that combat bonuses section.

Heaviness curse is a nice idea, BTW, I will probably steal it back from you
Thanks, but I can't tell how I would add object weight in calc_bonuses(). I guess I would I need to add a weight field in the player_state struct?

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.
__________________
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...)

Last edited by will_asher; August 21, 2021 at 05:52.
will_asher is offline   Reply With Quote
Old August 21, 2021, 06:33   #158
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 56
Posts: 9,173
Donated: $60
Nick will become famous soon enoughNick will become famous soon enough
Quote:
Originally Posted by will_asher View Post
Thanks, but I can't tell how I would add object weight in calc_bonuses(). I guess I would I need to add a weight field in the player_state struct?
You're correct, putting it in calc_bonuses() was bad advice

It looks like this is actually a bit of work. The way I would do it is:
  1. 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.
  2. Then search though for all uses of object weight in calculations or display, and replace obj->weight with object_weight(obj).
Alternatively, you could file it as an issue for Vanilla and hope someone else does it...
__________________
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
Nick is offline   Reply With Quote
Old August 27, 2021, 03:53   #159
will_asher
DaJAngband Maintainer
 
will_asher's Avatar
 
Join Date: Apr 2007
Location: San Antonio, TX
Posts: 1,124
Donated: $10
will_asher is on a distinguished road
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...)
will_asher is offline   Reply With Quote
Old August 27, 2021, 03:59   #160
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 56
Posts: 9,173
Donated: $60
Nick will become famous soon enoughNick will become famous soon enough
Quote:
Originally Posted by will_asher View Post
In this line:
int player_noise = 1 << (30 - stealth);
what does the "<<" mean?
It's the left shift operator - it shifts all the bits to the left, which is effectively multiplying by a power of 2. So 1 << 1 is 2, 1 << 2 is 4, 1 << 3 is 8, etc.
__________________
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
Nick is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
can we make identify more common ? Sky Vanilla 16 September 10, 2017 11:20
Make Artistry automatic bagori nd Sil 4 September 26, 2016 19:22
How many variant developers/maintainers have beaten their own variant? Delver Variants 12 June 5, 2009 10:08
Variant writing.. quickstart guide? Also, Hengband variant suggestions? dzhang Variants 34 April 1, 2009 01:45
Trying to make my own variant bpleshek Variants 8 September 15, 2008 21:42


All times are GMT +1. The time now is 22:39.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.