Fixed bug: Casting invisibilty/unholy armor on volatile units, they should explode.

This commit is contained in:
johns 2001-04-28 20:24:57 +00:00
parent 9722770b39
commit 5fa58b0d81
8 changed files with 42 additions and 20 deletions

View file

@ -625,6 +625,8 @@
<LI>Automatic groups added.
<LI>Fixed bug: Units in training queues aren't upgraded. (Paladin,Ranger...)
<LI>Fixed bug: Polymorph over water, places a critter on water :).
<LI>Fixed bug: Casting invisibilty/unholy armor on volatile units, they
should explode.
<LI>+++
</UL>
</UL>

View file

@ -173,7 +173,7 @@ struct _unit_type_ {
unsigned GoldMine : 1; ///
unsigned Hero : 1; ///
unsigned StoresOil : 1; ///
unsigned Explodes : 1; /// invisiblity/unholy armor kills unit
unsigned Volatile : 1; /// invisiblity/unholy armor kills unit
unsigned CowerMage : 1; ///
unsigned Organic : 1; /// organic

View file

@ -701,13 +701,23 @@ global int SpellCast(const SpellType * spell, Unit * unit, Unit * target,
&& target->Invisible < spell->TTL/FRAMES_PER_SECOND) {
// get mana cost
unit->Mana -= spell->ManaCost;
target->Invisible = spell->TTL/FRAMES_PER_SECOND; // about 50 sec
CheckUnitToBeDrawn(target);
if( target->Type->Volatile ) {
RemoveUnit(target);
UnitLost(target);
ReleaseUnit(target);
MakeMissile(MissileTypeExplosion,
x*TileSizeX+TileSizeX/2, y*TileSizeY+TileSizeY/2,
x*TileSizeX+TileSizeX/2, y*TileSizeY+TileSizeY/2 );
} else {
// about 50 sec
target->Invisible = spell->TTL/FRAMES_PER_SECOND;
CheckUnitToBeDrawn(target);
}
PlayGameSound(SoundIdForName(spell->Casted.Name),MaxSampleVolume);
MakeMissile(MissileTypeSpell,
x*TileSizeX+TileSizeX/2, y*TileSizeY+TileSizeY/2,
x*TileSizeX+TileSizeX/2, y*TileSizeY+TileSizeY/2 );
x*TileSizeX+TileSizeX/2, y*TileSizeY+TileSizeY/2,
x*TileSizeX+TileSizeX/2, y*TileSizeY+TileSizeY/2 );
}
break;
@ -972,8 +982,18 @@ global int SpellCast(const SpellType * spell, Unit * unit, Unit * target,
&& target->UnholyArmor < spell->TTL/FRAMES_PER_SECOND) {
// get mana cost
unit->Mana -= spell->ManaCost;
target->UnholyArmor = spell->TTL/FRAMES_PER_SECOND; // about 13 sec
CheckUnitToBeDrawn(target);
if( target->Type->Volatile ) {
RemoveUnit(target);
UnitLost(target);
ReleaseUnit(target);
MakeMissile(MissileTypeExplosion,
x*TileSizeX+TileSizeX/2, y*TileSizeY+TileSizeY/2,
x*TileSizeX+TileSizeX/2, y*TileSizeY+TileSizeY/2 );
} else {
// about 13 sec
target->UnholyArmor = spell->TTL/FRAMES_PER_SECOND;
CheckUnitToBeDrawn(target);
}
PlayGameSound(SoundIdForName(spell->Casted.Name),MaxSampleVolume);
MakeMissile(MissileTypeSpell,

View file

@ -588,7 +588,7 @@ local void UpdateButtonPanelMultipleUnits(void)
}
} else if ( UnitButtonTable[z]->Action == ButtonDemolish ) {
for( i=NumSelected; --i; ) {
if( Selected[i]->Type->Explodes ) {
if( Selected[i]->Type->Volatile ) {
allow = 1;
break;
}
@ -719,7 +719,7 @@ global void UpdateButtonPanel(void)
}
break;
case ButtonDemolish:
if( Selected[0]->Type->Explodes ) {
if( Selected[0]->Type->Volatile ) {
allow = 1;
}
break;

View file

@ -766,7 +766,7 @@ local void SendDemolish(int x,int y)
for( i=0; i<NumSelected; ++i ) {
unit=Selected[i];
if( unit->Type->Explodes ) {
if( unit->Type->Volatile ) {
// FIXME: choose correct unit no flying ...
dest=TargetOnMapTile(unit,x,y);
if( dest==unit ) { // don't let an unit self destruct

View file

@ -441,7 +441,7 @@ local SCM CclDefineUnitType(SCM list)
type->GoldMine=0;
type->Hero=0;
type->StoresOil=0;
type->Explodes=0;
type->Volatile=0;
type->CowerMage=0;
type->Organic=0;
type->SelectableByRectangle=0;
@ -534,7 +534,7 @@ local SCM CclDefineUnitType(SCM list)
} else if( gh_eq_p(value,gh_symbol2scm("stores-oil")) ) {
type->StoresOil=1;
} else if( gh_eq_p(value,gh_symbol2scm("volatile")) ) {
type->Explodes=1;
type->Volatile=1;
} else if( gh_eq_p(value,gh_symbol2scm("cower-mage")) ) {
type->CowerMage=1;
} else if( gh_eq_p(value,gh_symbol2scm("organic")) ) {

View file

@ -483,7 +483,7 @@ global void PrintUnitTypeTable(void)
printf("\t,%5d,%5d,%10d,%6d,%8d,%6d\n"
,type->Hero
,type->StoresOil
,type->Explodes
,type->Volatile
,type->CowerMage
,type->Organic
,type->SelectableByRectangle);
@ -764,7 +764,7 @@ global void ParsePudUDTA(const char* udta,int length)
unittype->GoldMine=BIT(22,v);
unittype->Hero=BIT(23,v);
unittype->StoresOil=BIT(24,v);
unittype->Explodes=BIT(25,v);
unittype->Volatile=BIT(25,v);
unittype->CowerMage=BIT(26,v);
unittype->Organic=BIT(27,v);
@ -1129,7 +1129,7 @@ local void SaveUnitType(const UnitType* type,FILE* file)
if( type->StoresOil ) {
fprintf(file," 'stores-oil\n");
}
if( type->Explodes ) {
if( type->Volatile ) {
fprintf(file," 'volatile\n");
}
if( type->CowerMage ) {

View file

@ -286,7 +286,7 @@ typedef struct _unit_type_ {
unsigned GoldMine : 1;
unsigned Hero : 1;
unsigned StoresOil : 1;
unsigned Explodes : 1; // invisiblity/unholy armor killes this unit
unsigned Volatile : 1; // invisiblity/unholy armor killes this unit
unsigned CowerMage : 1;
unsigned Organic : 1;
@ -1569,7 +1569,7 @@ void DumpUdtaAsScm(void)
if( UnitTypes[i].StoresOil ) {
printf(" 'stores-oil\n");
}
if( UnitTypes[i].Explodes ) {
if( UnitTypes[i].Volatile ) {
printf(" 'volatile\n");
}
if( UnitTypes[i].CowerMage ) {
@ -1739,7 +1739,7 @@ int main(int argc,char** argv)
UnitTypes[i].GoldMine=BIT(22,v);
UnitTypes[i].Hero=BIT(23,v);
UnitTypes[i].StoresOil=BIT(24,v);
UnitTypes[i].Explodes=BIT(25,v);
UnitTypes[i].Volatile=BIT(25,v);
UnitTypes[i].CowerMage=BIT(26,v);
UnitTypes[i].Organic=BIT(27,v);
if( BIT(28,v) ) printf("Unused bit 28 used in %d\n",i);
@ -1806,7 +1806,7 @@ if( 0 )
printf("\tMine\t%d\n",UnitTypes[i].GoldMine);
printf("\tHero\t%d\n",UnitTypes[i].Hero);
printf("\tStoresOil\t%d\n",UnitTypes[i].StoresOil);
printf("\tExplodes\t%d\n",UnitTypes[i].Explodes);
printf("\tVolatile\t%d\n",UnitTypes[i].Volatile);
printf("\tCowerMage\t%d\n",UnitTypes[i].CowerMage);
printf("\tOrganic\t%d\n",UnitTypes[i].Organic);
}
@ -1928,7 +1928,7 @@ if( 0 )
printf(",%d,%d,%d,%d,%d,%d"
,UnitTypes[i].Hero
,UnitTypes[i].StoresOil
,UnitTypes[i].Explodes
,UnitTypes[i].Volatile
,UnitTypes[i].CowerMage
,UnitTypes[i].Organic
,UnitTypes[i].SelectableByRectangle);