wbase.zsc (3895B)
1 class DevilbunnyWeapon : Weapon 2 { 3 bool parries; 4 property CanParry : parries; 5 6 bool parryAnimReady; //enable in ready state, disable when you don't want the animation to play. Should only be used if the weapon has a parry state. 7 8 override void PostBeginPlay() 9 { 10 parryAnimReady = FALSE; 11 Super.PostBeginPlay(); 12 } 13 14 15 action void setWeaponState(statelabel st,int layer=PSP_WEAPON) 16 { 17 if(player) 18 { 19 player.setpsprite(layer,invoker.findstate(st)); 20 } 21 } 22 23 24 action void VertFan(int damagemin, int damagemax, int range) 25 { 26 A_StartSound("bigwoosh", CHAN_WEAPON, CHANF_DEFAULT); 27 for(int offz = 0; offz <= 120; offz += 20) 28 { 29 LineAttack(Angle, range, Pitch, random(damagemin, damagemax), "PlayerDamage", "SlashEffectBase", LAF_NORANDOMPUFFZ | LAF_OVERRIDEZ, null, offz, 0, -5); 30 LineAttack(Angle, range, Pitch, random(damagemin, damagemax), "PlayerDamage", "SlashEffectBase", LAF_NORANDOMPUFFZ | LAF_OVERRIDEZ, null, offz + 10, 0, 5); 31 } 32 } 33 34 action void HorizFan(int startoffs, int endoffs, int damagemin, int damagemax, int range, class<Actor> pufftype = null, class<Actor> clangtype = null) 35 { 36 FTranslatedLineTarget t; 37 bool hitflesh = FALSE; 38 39 //this lineattack is only for making the clang sound and spawning a decal if the player swings their sword near a wall 40 //TODO: Implement for vertfan 41 LineAttack(Angle, range / 3, Pitch, 0, "None", clangtype, LAF_NORANDOMPUFFZ); 42 43 if (startoffs > endoffs) 44 { 45 for (int offs = startoffs; offs >= endoffs; offs -= 10) 46 { 47 LineAttack(Angle, range, Pitch, random(damagemin, damagemax), "PlayerDamage", pufftype, LAF_NORANDOMPUFFZ, t, 0, 0, offs); 48 if (t.linetarget) {hitflesh = TRUE;} 49 } 50 } 51 else 52 { 53 for (int offs = startoffs; offs <= endoffs; offs += 10) 54 { 55 LineAttack(Angle, 192, Pitch, random(damagemin,damagemax), "PlayerDamage", pufftype, LAF_NORANDOMPUFFZ, t, 0, 0, offs); 56 if (t.linetarget) {hitflesh = TRUE;} 57 } 58 } 59 if (hitflesh == TRUE) 60 { 61 A_StartSound("fleshchop", CHAN_WEAPON, CHANF_DEFAULT); 62 } 63 else 64 { 65 A_StartSound("swing", CHAN_WEAPON); 66 //A_StartSound("fleshhit", CHAN_WEAPON, CHANF_DEFAULT); 67 } 68 } 69 70 default 71 { 72 DevilbunnyWeapon.CanParry TRUE; 73 +WEAPON.MELEEWEAPON 74 } 75 } 76 77 class SlashProtect : PowerProtection 78 { 79 default 80 { 81 DamageFactor "PlayerDamage", 0; 82 Powerup.Duration 8; 83 Inventory.MaxAmount 1; 84 } 85 } 86 87 class SlashPuffTimer : Powerup 88 { 89 default 90 { 91 Powerup.Duration 8; 92 Inventory.MaxAmount 1; 93 } 94 } 95 96 //bit of a hack, give the target a temporary item that makes them immune to damage from the player, so they don't get hit by multiple slashfan tracers. Inheriting actors should call GrantImmune() in their XDeath state 97 class SlashEffectBase : BulletPuff 98 { 99 default 100 { 101 Species "Player"; 102 +ALWAYSPUFF 103 +ALLOWTHRUFLAGS 104 +THRUSPECIES 105 +HITTRACER 106 +PUFFONACTORS 107 +BLOODLESSIMPACT 108 +NOEXTREMEDEATH 109 DamageType "PlayerDamage"; 110 } 111 112 void GrantImmune() 113 { 114 if (tracer.CountInv("SlashPuffTimer")) 115 { 116 tracer.GiveInventory("SlashProtect", 1); 117 return; 118 } 119 tracer.GiveInventory("SlashPuffTimer",1); 120 } 121 122 States 123 { 124 Crash: 125 TNT1 A 1 126 { 127 bALLOWPARTICLES = 0; 128 } 129 Stop; 130 XDeath: 131 TNT1 A 0 132 { 133 GrantImmune(); 134 } 135 Stop; 136 } 137 } 138 139 //Knocks back and deals minor damage in a radius. Most weapons should have their own special one that inherits from this 140 class StrikeBlast : FastProjectile 141 { 142 Default 143 { 144 Radius 1; 145 Height 1; 146 Speed 20; 147 +THRUACTORS 148 +THRUSPECIES 149 Damage 0; 150 Projectile; 151 // +FORCERADIUSDMG 152 //Decal "SwordSlash"; 153 DamageType "PlayerDamage"; 154 Species "Player"; 155 } 156 157 States 158 { 159 Spawn: 160 TNT1 AAA 2 161 { 162 A_Explode(random(5,10), 128, 0, FALSE, 128); 163 } 164 stop; 165 Death: 166 TNT1 A 6; 167 stop; 168 Crash: 169 XDeath: 170 stop; 171 } 172 }