//************************************************************************** //** //** ## ## ## ## ## #### #### ### ### //** ## ## ## ## ## ## ## ## ## ## #### #### //** ## ## ## ## ## ## ## ## ## ## ## ## ## ## //** ## ## ######## ## ## ## ## ## ## ## ### ## //** ### ## ## ### ## ## ## ## ## ## //** # ## ## # #### #### ## ## //** //** $Id: PowerInvulnerable.vc 2600 2007-08-08 21:15:51Z dj_jl $ //** //** Copyright (C) 1999-2006 Jānis Legzdiņš //** //** This program is free software; you can redistribute it and/or //** modify it under the terms of the GNU General Public License //** as published by the Free Software Foundation; either version 2 //** of the License, or (at your option) any later version. //** //** This program is distributed in the hope that it will be useful, //** but WITHOUT ANY WARRANTY; without even the implied warranty of //** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //** GNU General Public License for more details. //** //************************************************************************** class PowerInvulnerable : Powerup; // For cleric's invulnerability effect bool bAltShadow; bool bShadow; bool bDontDraw; int PrevTicTime; //========================================================================== // // InitEffect // //========================================================================== void InitEffect() { if (!BlendColour) { BlendColour = LineSpecialGameInfo( Level.Game).DefaultInvulnBlendColour; } // If we don't have any specific mode, set it to the default of the // player class. if (!Mode && Owner.bIsPlayer) { Mode = PlayerEx(Owner.Player).GetInvulnerabilityMode(); } EntityEx(Owner).bInvulnerable = true; if (Mode == 'Reflective') { EntityEx(Owner).bReflective = true; } } //========================================================================== // // DoEffect // //========================================================================== void DoEffect() { ::DoEffect(); if (!Owner) { return; } int TicTime = ftoi(Level.XLevel.Time * 35.0); if (TicTime == PrevTicTime) { return; } PrevTicTime = TicTime; if (Mode == 'Ghost') { if (!(TicTime & 7) && bShadow && !bDontDraw) { bShadow = false; if (!bAltShadow) { bDontDraw = true; EntityEx(Owner).bNonShootable = true; } } if (!(TicTime & 31)) { if (bDontDraw) { if (!bShadow) { bShadow = true; bAltShadow = true; } else { bDontDraw = false; EntityEx(Owner).bNonShootable = false; } } else { bShadow = true; bAltShadow = false; } } if (bDontDraw) { Owner.Alpha = 0.0; } else if (bShadow) { Owner.Alpha = 0.333; } else if (bAltShadow) { Owner.Alpha = 0.666; } else { Owner.Alpha = 1.0; } } /*if (Mode == 'Ghost') { if (!(TicTime & 7) && Owner.Alpha > 0.0 && Owner.Alpha < 1.0) { if (Owner.Alpha == 0.666) { Owner.Alpha = 0.333; } else { Owner.Alpha = 0.0; EntityEx(Owner).bNonShootable = true; } } if (!(TicTime & 31)) { if (Owner.Alpha == 0.0) { Owner.Alpha = 0.333; EntityEx(Owner).bNonShootable = false; } else { Owner.Alpha = 0.666; } } }*/ if (Mode == 'Initial') { if (!(TicTime & 1) && Owner.Alpha > 0.0 && Owner.Alpha < 1.0) { if (Owner.Alpha == 0.666) { Owner.Alpha = 0.333; } else { Owner.Alpha = 0.0; } } if (!(TicTime & 2)) { if (Owner.Alpha == 0.0) { Owner.Alpha = 0.333; } else { Owner.Alpha = 0.666; } } if (!(TicTime & 3) && Owner.Alpha > 0.0 && Owner.Alpha < 1.0) { if (Owner.Alpha == 0.666) { Owner.Alpha = 0.333; } else { Owner.Alpha = 0.0; } } if (!(TicTime & 4)) { if (Owner.Alpha == 0.0) { Owner.Alpha = 0.333; } else { Owner.Alpha = 0.666; } } } } //========================================================================== // // EndEffect // //========================================================================== void EndEffect() { if (!Owner) { return; } EntityEx(Owner).bInvulnerable = false; if (Mode == 'Reflective') { EntityEx(Owner).bReflective = false; } else if (Mode == 'Ghost') { EntityEx(Owner).bNonShootable = false; Owner.Alpha = 1.0; } else if (Mode == 'Initial') { Owner.Alpha = 1.0; } if (Owner.Player) { Owner.Player.FixedColourmap = 0; } } defaultproperties { EffectTime = 30.0; }