[CF-Devel] stat potions: patch/question
crossfire-devel at archives.real-time.com
crossfire-devel at archives.real-time.com
Sat Mar 13 17:05:39 CST 2004
On Tue, 9 Mar 2004, Bernd Edler wrote:
>
>
I noticed a bug:
>
If a natural stat gets below 1, one can no longer
>
raise it with stat potions.
>
>
It is possible to get to 0, if you drink too many
>
cursed stat potions.
>
You can even have a negative natural starting stat due to
>
negative class modificators.
>
Example: start int 9 -> quez,int 9-8 = 1 -> barbarian, int 1-6 = -5.
>
>
With this patch one can now raise these stats with potions.
>
Furthermore cursed potions no longer drain you below 1.
>
>
Now for the question:
>
>
In the original code tmp->stats.sp (the potions spellpoints)
>
is used in the if condition,then set to 0 if a stat is changed.
>
>
As i do not understand the intention for /* Fix it up for super potions */
>
, i can not emulate the desired behavior.
>
>
I do know, that this stuff has no relevance to normal stat potions,as
>
their sp is 0 anyway.
>
>
So if somebody can explain that, i can finish this patch.
>
After checking the archetypes, artifacts and all map files,
i think that potions with stat boni and sp!=0
do not exist in the game.
Thus, i am positive, this new patch will fix the bug
without breaking anything else.
-------------- next part --------------
Index: common/living.c
===================================================================
RCS file: /cvsroot/crossfire/crossfire/common/living.c,v
retrieving revision 1.60
diff -c -r1.60 living.c
*** common/living.c 27 Feb 2004 23:00:26 -0000 1.60
--- common/living.c 13 Mar 2004 22:36:30 -0000
***************
*** 355,361 ****
* that gives them that ability.
*/
int change_abil(object *op, object *tmp) {
! int flag=QUERY_FLAG(tmp,FLAG_APPLIED)?1:-1,i,j,success=0;
object refop;
char message[MAX_BUF];
int potion_max=0;
--- 355,362 ----
* that gives them that ability.
*/
int change_abil(object *op, object *tmp) {
! int flag=QUERY_FLAG(tmp,FLAG_APPLIED)?1:-1;
! int i,j,potion,newstat,success=0;
object refop;
char message[MAX_BUF];
int potion_max=0;
***************
*** 367,390 ****
if(op->type==PLAYER) {
if (tmp->type==POTION) {
for(j=0;j<NUM_STATS;j++) {
i = get_attr_value(&(op->contr->orig_stats),j);
!
! /* Check to see if stats are within limits such that this can be
! * applied.
! */
! if (((i+flag*get_attr_value(&(tmp->stats),j))<=
! (20+tmp->stats.sp + get_attr_value(&(op->arch->clone.stats),j)))
! && i>0)
! {
! change_attr_value(&(op->contr->orig_stats),j,
! flag*get_attr_value(&(tmp->stats),j));
! tmp->stats.sp=0;/* Fix it up for super potions */
! }
! else {
! /* potion is useless - player has already hit the natural maximum */
! potion_max = 1;
! }
}
/* This section of code ups the characters normal stats also. I am not
* sure if this is strictly necessary, being that fix_player probably
--- 368,388 ----
if(op->type==PLAYER) {
if (tmp->type==POTION) {
+ potion_max=1;
for(j=0;j<NUM_STATS;j++) {
i = get_attr_value(&(op->contr->orig_stats),j);
! potion = flag*get_attr_value(&(tmp->stats),j);
! newstat=i+potion;
! if (potion<0) { /* stat drain */
! if (i<1) continue; /* No miracle cure for negative starting stats */
! else if (newstat<1) newstat=1; /* No drain below 1 */
! }
! else if (newstat>20+get_attr_value(&(op->arch->clone.stats),j))
! newstat=20+get_attr_value(&(op->arch->clone.stats),j);
! if ( newstat != i ) {
! set_attr_value(&(op->contr->orig_stats),j,newstat);
! potion_max=0;
! }
}
/* This section of code ups the characters normal stats also. I am not
* sure if this is strictly necessary, being that fix_player probably
-------------- next part --------------
_______________________________________________
crossfire-devel mailing list
crossfire-devel at lists.real-time.com
https://mailman.real-time.com/mailman/listinfo/crossfire-devel
More information about the crossfire
mailing list