NarumiSTG_HyperSnowDrifter/script/player/Narumi/Player_Function.dnh

245 lines
6.2 KiB
Plaintext
Raw Normal View History

2023-01-26 11:34:56 +00:00
#include "./Player_Function_Laser.dnh"
// Shot Type
int[] optionArr = [];
float angSpace = 2.5;
float[] angStartArr = [];
// Far left, left, right, far right
float[] angStartUF = [230, 270, 270, 310];
float[] angStartUFAlt = [230, 275, 265, 310];
float[] angStartF = [250, 280, 260, 290];
float offsetX = 125;
float offsetY = 75;
int[] bulletNum = [4, 3, 3, 4];
task ShotType(){
}
task BaseShot(){
// 5 way shot
float[] angDist = [10, 5];
float ang = -7.5;
float ang2 = -22.5;
while(true){
if(GetVirtualKeyState(VK_SPELL) == KEY_FREE && IsPermitPlayerShot && !ripplayer){
// C for alt shot
if(GetVirtualKeyState(VK_USER1) != KEY_FREE){
if(shotspeed % 4 == 0){
ObjSound_Play(Base3);
ascent(i in 0..3){
let shotA = CreatePlayerShotA1(playerX, playerY, 52, ang2 - ang2 * (i * 1), shotDamageOption, 1.5, AMULET);
_BulletRescalePlayer(shotA, shotScaleOption, true, 1);
ObjRender_SetAlpha(shotA, shotAlpha);
Obj_SetRenderPriorityI(shotA, 41);
}
ascent(i in 0..3){
let shotB = CreatePlayerShotA1(playerX, playerY, 52, ang2 - ang2 * (i * 1) + 180, shotDamageOption, 1.5, AMULET);
_BulletRescalePlayer(shotB, shotScaleOption, true, 1);
ObjRender_SetAlpha(shotB, shotAlpha);
Obj_SetRenderPriorityI(shotB, 41);
}
}
}
// Z/Z+C for normal shot
else if(GetVirtualKeyState(VK_SHOT) != KEY_FREE && GetVirtualKeyState(VK_USER1) == KEY_FREE){
if(shotspeed % 4 == 0){
ObjSound_Play(Base3);
ascent(b in -2..3){
let shotC = CreatePlayerShotA1(playerX, playerY, 52, 0 + ang * b, shotDamageOption, 1.5, AMULET);
_BulletRescalePlayer(shotC, shotScaleOption, true, 1);
ObjRender_SetAlpha(shotC, shotAlpha);
Obj_SetRenderPriorityI(shotC, 41);
}
}
}
else{}
}
yield;
}
}
task SpecialWeapon(){
// Create projectile, but disable hitbox & visibility
int golem = CreatePlayerShotA1(playerX+128, playerY, 0, 0, shotDamageSpecial * 5.25, 999999, GOLEM);
ObjShot_SetAutoDelete(golem, false);
ObjShot_SetEraseShot(golem, true);
ObjShot_SetPenetrateShotEnable(golem, true);
ObjShot_SetIntersectionEnable(golem, false);
Obj_SetVisible(golem, false);
ObjRender_SetAlpha(golem, 0);
ObjShot_SetSpellFactor(golem, true);
_BulletRescalePlayer(golem, 1.5, true, 1);
ObjShot_SetSpinAngularVelocity(golem, 6);
float i = 0;
while(true){
if(GetVirtualKeyState(VK_SPELL) != KEY_FREE && GetCommonDataPtr(POINTER_SPECIALAMMO, 100) > 0 && !ripplayer){
if(shotspeed % 4 == 0){ObjSound_Play(Fire);}
i = min(210, i+210/10);
ObjMove_SetPosition(golem, playerX + i, playerY);
ObjRender_SetAlpha(golem, min(255, ObjRender_GetAlpha(golem)+255/10));
//SetCommonDataPtr(POINTER_SPECIALCHECK, true);
SetCommonDataPtr(POINTER_CHAINCHECK, true);
SetPlayerSpeed(PlayerSpd[0]*1.5, PlayerSpd[1]*1.5);
// (Approx.) 20 ammo per second
SetCommonDataPtr(POINTER_SPECIALAMMO, max(0, GetCommonDataPtr(POINTER_SPECIALAMMO, 100)-(20/60)));
ObjShot_SetIntersectionEnable(golem, true);
Obj_SetVisible(golem, true);
// +1 rank per 10 seconds of use
SetCommonData("Rank", clamp(GetCommonData("Rank", 1)+1/600, 1, GetCommonData("MaxRank", 6)));
/*
if(shotspeed % 4 == 0){
float x = ObjMove_GetX(ID);
float y = ObjMove_GetY(ID);
// Minimal rank boost -> +0.5 rank for every 10 seconds of the wpn being used -> 1/20 rank every sec -> 1/300 rank every 4 frames
SetCommonData("Rank", clamp(GetCommonData("Rank", 1) + 1/300, GetCommonData("MinRank", 1), GetCommonData("MaxRank", 12)));
angFire[0] = 270 + angFlux * sin(ang1) + rand(-5, 5);
angFire[1] = 270 + angFlux * sin(ang2) + rand(-5, 5);
// YASS FIRE THOSE BITCH KILLER SLASHES
FireSlash(angFire[0], 50, 35, 45);
FireSlash(angFire[1], 50, 35, 45);
ang1 += 25;
ang2 -= 25;
}
*/
}
else{
// Refills 5 ammo per second
i = max(0, i-210/10);
ObjMove_SetPosition(golem, playerX + i, playerY);
ObjRender_SetAlpha(golem, max(0, ObjRender_GetAlpha(golem)-255/10));
SetPlayerSpeed(PlayerSpd[0], PlayerSpd[1]);
SetCommonDataPtr(POINTER_SPECIALAMMO, min(100, GetCommonDataPtr(POINTER_SPECIALAMMO, 100)+(5/60)));
SetCommonDataPtr(POINTER_CHAINCHECK, false);
ObjShot_SetIntersectionEnable(golem, false);
//if(GetCommonDataPtr(POINTER_CHAINGAUGE, 0) <= 0){SetCommonDataPtr(POINTER_SPECIALCHECK, false);}
}
yield;
}
}
task FireSlash(
float angle, baseSpd,
int decelTime, lifeTime
){
int slash = CreatePlayerShotA1(playerX, playerY, baseSpd, angle, shotDamageSpecial, 8, 1);
ObjShot_SetPenetrateShotEnable(slash, false);
_BulletRescalePlayer(slash, shotScaleSpecial, true, 1);
Obj_SetRenderPriorityI(slash, plrender-1);
//ObjRender_SetBlendType(slash, BLEND_ADD_ARGB);
ObjSound_Play(Base5);
ObjShot_SetEraseShot(slash, true);
async{
ascent(i in 0..3){
int slashA = CreatePlayerShotA1(playerX, playerY, baseSpd, angle, shotDamageSpecial/5, 32, 1);
_BulletRescalePlayer(slashA, shotScaleSpecial/2, true, 1);
//ObjRender_SetBlendType(slashA, BLEND_ADD_ARGB);
ObjShot_SetPenetrateShotEnable(slashA, false);
Obj_SetRenderPriorityI(slashA, plrender-1);
Fade(slashA);
wait(10);
}
}
task Fade(int ID){
ObjMove_AddPatternA2(ID, 0, baseSpd/2, [rand(180, 230), rand(-50, 30)][rand_int(0, 1)], (-baseSpd/2)/(decelTime), 2, 0);
ascent(i in 0..(decelTime)){
ObjRender_SetAlpha(ID, Interpolate_Accelerate(shotAlpha, 0, i/(decelTime)));
yield;
}
Obj_Delete(ID);
}
async{
ObjMove_SetAcceleration(slash, -baseSpd/decelTime);
ObjMove_SetMaxSpeed(slash, baseSpd/50);
ObjRender_SetAlpha(slash, shotAlpha);
ascent(i in 0..decelTime){
ObjRender_SetScaleXYZ(slash, Interpolate_Accelerate(shotScaleSpecial/1.25, shotScaleSpecial, i/decelTime));
yield;
}
ascent(i in 0..(lifeTime-decelTime)){
ObjRender_SetAlpha(slash, Interpolate_Accelerate(shotAlpha, 0, i/(lifeTime-decelTime)));
yield;
}
Obj_Delete(slash);
}
}
// Bomb
// Holy fuck its literally YoumuA IBP