NarumiSTG_HyperSnowDrifter/script/player/Narumi/Player_Function.dnh

242 lines
5.6 KiB
Plaintext

#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.25, 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.25, 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) > 20/60 && !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));
Obj_SetVisible(golem, true);
SetCommonDataPtr(POINTER_CHAINCHECK, true);
SetPlayerSpeed(PlayerSpd[0]*1.5, PlayerSpd[1]*1.5);
// (Approx.) 20 ammo per second, 1/3 ammo per frame.
SetCommonDataPtr(POINTER_SPECIALAMMO, max(0, GetCommonDataPtr(POINTER_SPECIALAMMO, 100)-(20/60)));
if(ObjRender_GetAlpha(golem) >= 150){
ObjShot_SetIntersectionEnable(golem, true);
}
else{
ObjShot_SetIntersectionEnable(golem, false);
}
// +1 rank per 10 seconds of use
SetCommonData("Rank", clamp(GetCommonData("Rank", 1)+1/600, 1, GetCommonData("MaxRank", 6)));
}
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]);
// Refills ammo by 1/12 ammo per frame.
if(GetVirtualKeyState(VK_SPELL) == KEY_FREE)
{SetCommonDataPtr(POINTER_SPECIALAMMO, min(100, GetCommonDataPtr(POINTER_SPECIALAMMO, 100)+(5/60)));}
else
{}
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