Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5590
Modified Files:
ChangeLog basechar.cpp pythonscript.cpp pythonscript.h
Log Message:
Implemented onCheckVictim and onDoDamage
Index: pythonscript.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/pythonscript.h,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -d -r1.44 -r1.45
*** pythonscript.h 17 Oct 2004 01:20:19 -0000 1.44
--- pythonscript.h 27 Oct 2004 14:06:53 -0000 1.45
***************
*** 90,93 ****
--- 90,95 ----
EVENT_RESURRECT,
EVENT_CHECKSECURITY,
+ EVENT_CHECKVICTIM,
+ EVENT_DODAMAGE,
EVENT_COUNT,
};
Index: basechar.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/basechar.cpp,v
retrieving revision 1.168
retrieving revision 1.169
diff -C2 -d -r1.168 -r1.169
*** basechar.cpp 21 Oct 2004 00:19:41 -0000 1.168
--- basechar.cpp 27 Oct 2004 14:06:51 -0000 1.169
***************
*** 2260,2263 ****
--- 2260,2267 ----
unsigned int cBaseChar::damage( eDamageType type, unsigned int amount, cUObject* source )
{
+ if (isInvulnerable()) {
+ return 0;
+ }
+
if ( isFrozen() )
{
***************
*** 2293,2300 ****
}
// The damage has been resisted or scripts have taken care of the damage otherwise
// Invulnerable Targets don't take any damage at all
! if ( amount == 0 || isInvulnerable() )
! {
return 0;
}
--- 2297,2318 ----
}
+ if (source && source->isChar() && source->canHandleEvent(EVENT_DODAMAGE)) {
+ P_CHAR sourceChar = static_cast<P_CHAR>(source);
+
+ PyObject* args = Py_BuildValue( "NiiN", sourceChar->getPyObject(), type, amount, getPyObject() );
+ PyObject* result = callEvent(EVENT_DAMAGE, args);
+
+ if (result) {
+ if (PyInt_Check(result))
+ amount = PyInt_AsLong(result);
+ Py_DECREF(result);
+ }
+
+ Py_DECREF(args);
+ }
+
// The damage has been resisted or scripts have taken care of the damage otherwise
// Invulnerable Targets don't take any damage at all
! if (amount == 0) {
return 0;
}
***************
*** 2321,2326 ****
}
! // There is a 33% chance that blood is created on hit by phsical means
! if ( type == DAMAGE_PHYSICAL && !RandomNum( 0, 2 ) )
{
int bloodColor = 0;
--- 2339,2344 ----
}
! // There is a 25% chance that blood is created on hit by phsical means
! if ( type == DAMAGE_PHYSICAL && !RandomNum( 0, 4 ) )
{
int bloodColor = 0;
Index: pythonscript.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/pythonscript.cpp,v
retrieving revision 1.55
retrieving revision 1.56
diff -C2 -d -r1.55 -r1.56
*** pythonscript.cpp 17 Oct 2004 01:20:19 -0000 1.55
--- pythonscript.cpp 27 Oct 2004 14:06:52 -0000 1.56
***************
*** 558,561 ****
--- 558,582 ----
"onCheckSecurity",
+ /*
+ \event onCheckVictim
+ \param npc The npc that is thinking about a new target.
+ \param victim The victim that is being thought about.
+ \param dist The distance in tiles to the victm.
+ \return True if the target is a valid victim, False otherwise.
+ \condition This is triggered when the NPC is looking for a better target.
+ It is triggered for every character that could be attacked by the NPC.
+ */
+ "onCheckVictim",
+
+ /*
+ \param char The character dealing the damage.
+ \param type The damage type.
+ \param amount The amount of damage.
+ \param victim The victim taking the damage.
+ \condition Triggered when a character deals damage to another character.
+ \return Return the new amount of damage dealt to the victim.
+ */
+ "onDoDamage",
+
0
};
Index: ChangeLog
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/ChangeLog,v
retrieving revision 1.122
retrieving revision 1.123
diff -C2 -d -r1.122 -r1.123
*** ChangeLog 21 Oct 2004 12:11:10 -0000 1.122
--- ChangeLog 27 Oct 2004 14:06:50 -0000 1.123
***************
*** 3,6 ****
--- 3,10 ----
Wolfpack 12.9.13 Beta (CVS)
- Fixed meditation skillcheck in mana regeneration code.
+ - Changed gm talk color.
+ - Implemented the onCheckVictim event.
+ - Implemented the onDoDamage event.
+ - Stablemasters now remove the stabled pets from the follower list.
Wolfpack 12.9.12 Beta (18. October 2004)
|