Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old March 16, 2020, 09:25   #11
wobbly
Veteran
 
Join Date: May 2012
Location: Adelaide, Australia
Posts: 2,253
wobbly is on a distinguished road
Well here's a start:

Code:
/**
 * Execute an effect chain.
 *
 * \param effect is the effect chain
 * \param origin is the origin of the effect (player, monster etc.)
 * \param obj    is the object making the effect happen (or NULL)
 * \param ident  will be updated if the effect is identifiable
 *               (NB: no effect ever sets *ident to false)
 * \param aware  indicates whether the player is aware of the effect already
 * \param dir    is the direction the effect will go in
 * \param beam   is the base chance out of 100 that a BOLT_OR_BEAM effect will beam
 * \param boost  is the extent to which skill surpasses difficulty, used as % boost. It
 *               ranges from 0 to 138.
 */
bool effect_do(struct effect *effect,
		struct source origin,
		struct object *obj,
		bool *ident,
		bool aware,
		int dir,
		int beam,
		int boost)
wobbly is online now   Reply With Quote
Old March 16, 2020, 10:09   #12
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 54
Posts: 8,058
Donated: $60
Nick will become famous soon enough
I think you'll have to write an effect handler (see effects.c - there are a whole lot of them) which will need to call py_attack_real() for each monster you want to hit. To do this you'll need to make py_attack_real() callable from other files, which means adding its definition to player-attack.h and including player-attack.h in effects.c.
__________________
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 March 16, 2020, 13:12   #13
DavidMedley
Swordsman
 
Join Date: Oct 2019
Posts: 415
DavidMedley is on a distinguished road
OK, thanks!
DavidMedley is offline   Reply With Quote
Old March 16, 2020, 15:09   #14
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,655
Donated: $40
Pete Mack is on a distinguished road
The reason things are so abstract now is that, while the code is somewhat harder to understand, it is much easier to add things. In the old days, you would need to modify:
* the parser
* at least one .h file
* the global spell list
* the config files

Now to add most spells all you need to change is a couple config (.txt) files and possibly a .h file. Your change requires new interpretation in-code, as you need to surface weapon attacks as a magic effect, so you need a new spell effect procedure.
Pete Mack is offline   Reply With Quote
Old March 16, 2020, 22:10   #15
DavidMedley
Swordsman
 
Join Date: Oct 2019
Posts: 415
DavidMedley is on a distinguished road
Quote:
Originally Posted by Pete Mack View Post
while the code is somewhat harder to understand, it is much easier to add things.
Yeah, that's what I figured. Thanks!
DavidMedley is offline   Reply With Quote
Old March 16, 2020, 22:23   #16
DavidMedley
Swordsman
 
Join Date: Oct 2019
Posts: 415
DavidMedley is on a distinguished road
Is there a faster way to check my C syntax than to try to make the whole project?
DavidMedley is offline   Reply With Quote
Old March 16, 2020, 23:31   #17
backwardsEric
Scout
 
Join Date: Aug 2019
Posts: 32
backwardsEric is on a distinguished road
Quote:
Originally Posted by DavidMedley View Post
Is there a faster way to check my C syntax than to try to make the whole project?
Are you using Visual Studio (or some other IDE)? For that, I can't offer specific advice. If you're using the makefiles, then you could recompile just one or more of the files, say mon-attack.c and mon-blows.c, by running

Code:
make src/mon-attack.o src/mon-blows.o
in the top-level directory (i.e. for the source file you are interested in, replace the .c with .o). For Mac OS X, the equivalent would be running

Code:
make -f Makefile.osx mon-attack.o man-blows.o
in the src directory. The makefiles, however, should only rebuild what's necessary for a change. So, unless you modified a header file that's widely used, you won't be gaining much by specifically recompiling a handful of files.
backwardsEric is offline   Reply With Quote
Old March 17, 2020, 01:45   #18
DavidMedley
Swordsman
 
Join Date: Oct 2019
Posts: 415
DavidMedley is on a distinguished road
Oh, OK. I tried cc and that was awful. I'll try this way, or not, since you say it won't help much anyway.

Last edited by DavidMedley; March 17, 2020 at 02:06. Reason: Was mistaken
DavidMedley is offline   Reply With Quote
Old March 17, 2020, 07:32   #19
DavidMedley
Swordsman
 
Join Date: Oct 2019
Posts: 415
DavidMedley is on a distinguished road
A bit off-topic, but when I was trying to trace incremental changes to HP and SP, I found that SP regenerates every turn, but HP regens only every fourth turn, except when resting and then the ratio is 2 to 1. I don't understand how or why this is happening. Maybe I screwed something up.

I don't want to track it down right now, but I couldn't help but wonder aloud about it.
DavidMedley is offline   Reply With Quote
Old March 19, 2020, 09:39   #20
DavidMedley
Swordsman
 
Join Date: Oct 2019
Posts: 415
DavidMedley is on a distinguished road
Can someone explain the difference between power and mult in object_properties.txt?

# power: the value given to the property in object power calculations
# mult: relative value of properties, used in power calculations
# type-mult: extra multiplier used in power for particular properties on
# particular types of object. Assumed 1 if not mentioned
DavidMedley 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
is there a code? jozmon Development 19 August 4, 2014 00:38
Questions regarding vanilla inscriptions Avenger Vanilla 8 December 13, 2013 21:15
Questions regarding vanilla dungeon design Cazliostro Vanilla 23 October 11, 2010 12:05
code help please will_asher Variants 22 March 15, 2010 19:00
Looking through the code K.I.L.E.R Vanilla 5 July 11, 2007 08:01


All times are GMT +1. The time now is 10:46.


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