fix issues with TMonster constructor + Search functions + UH formula

The issue with the TMonster constructor was obvious, but the others
were slightly different from the original.
This commit is contained in:
fusion32 2026-05-09 12:24:34 -03:00
parent 7beaa081de
commit 54c2169ec9
4 changed files with 13 additions and 21 deletions

View File

@ -1984,8 +1984,8 @@ TMonster::TMonster(int Race, int x, int y, int z, int Home, uint32 MasterID) :
this->starty = y;
this->startz = z;
this->posx = x;
this->posx = y;
this->posx = z;
this->posy = y;
this->posz = z;
this->State = IDLE;
this->Home = Home;
this->Master = MasterID;

View File

@ -798,8 +798,8 @@ static Object CreateTempDepot(void){
return TempDepot;
}
// NOTE(fusion): This is used inside house processing functions to empty the depot
// container after processing a player's depot.
// NOTE(fusion): This is used by house processing functions to clear the temporary
// depot container after processing player depots.
static void DeleteContainerObjects(Object Con){
Object Obj = GetFirstContainerObject(Con);
while(Obj != NONE){

View File

@ -768,19 +768,14 @@ bool SearchFreeField(int *x, int *y, int *z, int Distance, uint16 HouseID, bool
int FieldY = *y + OffsetY;
int FieldZ = *z;
// TODO(fusion): This is probably some form of the `TCreature::MovePossible`
// function inlined.
bool MovePossible;
bool MovePossible = false;
if(Jump){
MovePossible = JumpPossible(FieldX, FieldY, FieldZ, true);
}else{
MovePossible = CoordinateFlag(FieldX, FieldY, FieldZ, BANK)
&& !CoordinateFlag(FieldX, FieldY, FieldZ, UNPASS);
// TODO(fusion): This one I'm not so sure.
if(MovePossible && CoordinateFlag(FieldX, FieldY, FieldZ, AVOID)){
MovePossible = CoordinateFlag(FieldX, FieldY, FieldZ, BED);
}
&& !CoordinateFlag(FieldX, FieldY, FieldZ, UNPASS)
&& (!CoordinateFlag(FieldX, FieldY, FieldZ, AVOID)
|| CoordinateFlag(FieldX, FieldY, FieldZ, BED));
}
if(MovePossible){
@ -792,11 +787,9 @@ bool SearchFreeField(int *x, int *y, int *z, int Distance, uint16 HouseID, bool
}
}
// NOTE(fusion): We're spiraling out from the initial coordinate.
// TODO(fusion): This function used directions different from the ones
// used by creatures and defined in `enums.hh` so I made it use them
// instead, LOL.
// NOTE(fusion): We're spiraling out from the initial coordinate. The
// original function used direction values different from the ones used
// by creatures and defined in `enums.hh` so I changed it for consistency.
if(CurrentDirection == DIRECTION_NORTH){
OffsetY -= 1;
if(OffsetY <= -CurrentDistance){
@ -979,9 +972,8 @@ bool SearchSpawnField(int *x, int *y, int *z, int Distance, bool Player){
if(ObjType.getFlag(UNMOVE)){
ExpansionPossible = false;
LoginPossible = LoginPossible && !Player;
}else{
LoginBad = true;
}
LoginBad = true;
}
Obj = Obj.getNextObject();

View File

@ -4119,7 +4119,7 @@ void UseMagicItem(uint32 CreatureID, Object Obj, Object Dest){
throw NOCREATURE;
}
int Amount = ComputeDamage(Actor, SpellNr, 250, 30);
int Amount = ComputeDamage(Actor, SpellNr, 250, 0);
Heal(Target, -1, 0, Amount); // -1 ?
break;
}