etayn

old gzdoom project
git clone git://moonbender.net/etayn
Log | Files | Refs | README

slot1-corpsacorps.zsc (3672B)


      1 //body to body in French. First weapon I wrote, need to clean this up.
      2 class CorpsACorps : DevilbunnyWeapon
      3 {
      4 	
      5 	Default
      6 	{
      7 		Weapon.SlotNumber 1;
      8 		Weapon.Kickback 1500;
      9 		+WEAPON.NOALERT
     10 		DevilbunnyWeapon.CanParry FALSE;
     11 	}
     12 	
     13 	action void BunPunch(int damagemin, int damagemax, int range, bool playclawsound = 0)
     14 	{
     15 		FTranslatedLineTarget t;
     16 		if (!playclawsound)
     17 		{
     18 			LineAttack(Angle, range, Pitch, random(damagemin, damagemax), "PlayerDamage", "HaraPunchPuff", LAF_NORANDOMPUFFZ, t, 0, 0, 0);
     19 		}
     20 		else
     21 		{
     22 			LineAttack(Angle, range, Pitch, random(damagemin, damagemax), "PlayerDamage", "HaraClawPuff", LAF_NORANDOMPUFFZ, t, 0, 0, 0);
     23 		}
     24 
     25 
     26 		if (t.linetarget)
     27 		{
     28 			if (!playclawsound)
     29 			{
     30 				A_StartSound("bun/punch", CHAN_WEAPON, CHANF_DEFAULT);
     31 			}
     32 			else
     33 			{
     34 				A_StartSound("bun/scratch", CHAN_WEAPON, CHANF_DEFAULT);
     35 			}
     36 		
     37 			let owner1 = DevilbunnyPlayer(self);
     38 			Actor v = t.linetarget;
     39 			owner1.summonTarget = v;
     40 			if (owner1.stunPunch == TRUE)
     41 			{
     42 				if (v.FindState("Pain") && !v.bDORMANT && v.bSHOOTABLE)
     43 				{
     44 					t.linetarget.SetStateLabel("Pain");
     45 				}
     46 			}
     47 		}
     48 	}
     49 	
     50 	States
     51 	{
     52 		Ready:
     53 			CLAW B 1
     54 			{
     55 				let owner1 = DevilbunnyPlayer(self);
     56 				if(owner1.hasSword == 0)
     57 				{
     58 					A_WeaponReady(WRF_NOSWITCH);
     59 				}
     60 				else
     61 				{
     62 					A_WeaponReady();
     63 				}
     64 			}
     65 			Loop;
     66 		Deselect:
     67 			CLAW A 1 A_Lower(999);
     68 			loop;
     69 		Select:
     70 			CLAW A 8 Offset(0, 32);
     71 			TNT1 A 0
     72 			{
     73 				//otherwise player can still draw their sword during the Select state
     74 				let owner1 = DevilbunnyPlayer(self);
     75 				if(owner1.hasSword == 0)
     76 				{
     77 					self.player.PendingWeapon = WP_NOCHANGE;
     78 				}
     79 			}
     80 			TNT1 A 0 A_Raise(999);
     81 			loop;
     82 		Fire:
     83 			TNT1 A 1
     84 			{
     85 				int ran = random(1, 2);
     86 				//punch if on ground, kick while in the air
     87 				if (pos.z <= (floorz + 10))
     88 				{
     89 					if (ran == 1) { setWeaponState("PunchRight"); }
     90 					if (ran == 2) { setWeaponState("PunchLeft"); }
     91 					return;
     92 				}
     93 				if (ran == 1) { setWeaponState("ClawLeft"); }
     94 				if (ran == 2) { setWeaponState("ClawRight"); }
     95 			}
     96 			goto Ready;
     97 		PunchRight:
     98 			CLAW C 6;
     99 			CLAW D 10 BunPunch(50, 150, 150);
    100 			Goto Ready;
    101 		PunchLeft:
    102 			CLAW E 6;
    103 			CLAW F 10 BunPunch(50, 150, 150);
    104 			Goto Ready;
    105 		ClawLeft:
    106 			CLAW G 6;
    107 			CLAW H 10 BunPunch(70, 170, 200, 1);
    108 			Goto Ready;
    109 		ClawRight:		
    110 			CLAW I 6;
    111 			CLAW J 10 BunPunch(70, 170, 200, 1);
    112 			Goto Ready;
    113 		AltFire:
    114 			TNT1 A 0
    115 			{
    116 				let owner1 = DevilbunnyPlayer(self);
    117 				
    118 				
    119 				if (owner1.hasSword == 0)
    120 				{
    121 					if (owner1.SpendSpirit(100))
    122 					{
    123 						if (owner1.thrownSword && owner1.thrownSword.ResolveState("Poof"))
    124 						{
    125 							owner1.thrownSword.SetStateLabel("Poof");
    126 						}
    127 					}
    128 					else
    129 					{
    130 						setWeaponState("Ready");
    131 					}
    132 				}
    133 				else
    134 				{
    135 					setWeaponState("Ready");
    136 				}
    137 			}
    138 			CLAW KL 8;
    139 			CLAW M 20;
    140 			TNT1 A 0
    141 			{
    142 				let owner1 = DevilbunnyPlayer(self);
    143 				owner1.hasSword = 1;
    144 				A_SelectWeapon("Pflug");
    145 			}
    146 			Goto Ready;
    147 	}
    148 }
    149 
    150 class HaraClawPuff: BulletPuff
    151 {
    152 	default
    153 	{
    154 		Species "Player";
    155 		+ALLOWTHRUFLAGS
    156 		+THRUSPECIES
    157 		+NOEXTREMEDEATH
    158 	//	+ALWAYSPUFF
    159 		-ALLOWPARTICLES
    160 		DamageType "PlayerDamage";
    161 		AttackSound "bun/wallscratch";
    162 	}
    163 
    164 	states
    165 	{
    166 		Spawn:
    167 		Crash:
    168 			TNT1 A 1; 
    169 			stop;
    170 	}
    171 }
    172 
    173 class HaraPunchPuff : BulletPuff
    174 {
    175 	default
    176 	{	
    177 		Species "Player";
    178 		+ALLOWTHRUFLAGS
    179 		+THRUSPECIES
    180 		+NOEXTREMEDEATH
    181 		-ALLOWPARTICLES
    182 		DamageType "PlayerDamage";
    183 		AttackSound "bun/punch";
    184 	}
    185 
    186 	states
    187 	{
    188 		Spawn:
    189 		Crash:
    190 			TNT1 A 1; 
    191 			stop;
    192 	}
    193 }