ScarletBlackMarket/ExRumia/DPS.dnh

246 lines
6.4 KiB
Plaintext
Raw Normal View History

#TouhouDanmakufu[Single]
#ScriptVersion[3]
#Title["DPS Test"]
#Text["thank you Daniel WishMakers"]
#System["script/KevinSystem/Kevin_System.txt"]
//let shotSheet = GetCurrentScriptDirectory() ~ "./../shot/shot.txt";
int bossObj; // This is enemy 1
int enm2, enm3; // This is enemy 2 and 3
let timer = 0;
let timer2 = 0;
let timer3 = 0;
let timer4 = 0;
//let phase = 0;
let angle = 0;
let angle2 = 0;
let angle3 = 0;
let angle4 = 0;
let x = 0;
let y = 0;
let image_angle = 0;
let HP = 10000000; //- (100 * difficulty);
// This is for the damage showing
let gl_curDPS = 0;
let gl_curDPS2 = 0;
let gl_curDPS3 = 0;
let gl_TimeSpent = 0;
let gl_TutorialStr = "";
const let STR_START = "Release SHOT before testing DPS.";
const let STR_GO = "Press and hold SHOT to start testing DPS.";
const let STR_FINISH = "Release SHOT when you are finished testing DPS.";
//#include "script/BHA5/script/Lib/BHA5_Lib.txt"
#include "script/KevinSystem/Universal_Lib.txt" // The library to include all libraries :sans: :nail_care:
@Event{
alternative(GetEventType())
case(EV_REQUEST_LIFE){
SetScriptResult(HP);
}
case(EV_REQUEST_TIMER){
SetScriptResult(9999);
}
case(EV_REQUEST_SPELL_SCORE){
SetScriptResult(1000000);
}
}
@Initialize{
//Shot sheet
//LoadTexture(shotSheet);
//LoadEnemyShotData(shotSheet);
SetPlayerLife(20);
//Boss registration
bossObj = ObjEnemy_Create(OBJ_ENEMY_BOSS);
ObjEnemy_Regist(bossObj);
//SetIntersectionVisualization(true);
let imgExRumia = GetModuleDirectory() ~ "script/ExRumia/ExRumia.png";
ObjPrim_SetTexture(bossObj, imgExRumia);
ObjSprite2D_SetSourceRect(bossObj, 64, 1, 127, 64);
ObjSprite2D_SetDestCenter(bossObj);
ObjRender_SetScaleXYZ(bossObj, 1.5, 1.5, 1);
ObjRender_SetColor(bossObj, 0xB93C3C);
ObjMove_SetDestAtFrame(bossObj, STG_WIDTH/2, 550, 1);
enm2 = ObjEnemy_Create(OBJ_ENEMY);
ObjEnemy_Regist(enm2);
//SetIntersectionVisualization(true);
//let imgExRumia = GetModuleDirectory() ~ "script/ExRumia/ExRumia.png";
ObjPrim_SetTexture(enm2, imgExRumia);
ObjSprite2D_SetSourceRect(enm2, 64, 1, 127, 64);
ObjSprite2D_SetDestCenter(enm2);
ObjRender_SetScaleXYZ(enm2, 1.5, 1.5, 1);
ObjRender_SetColor(enm2, 0xDC5959);
ObjMove_SetDestAtFrame(enm2, STG_WIDTH/2, 300, 1);
ObjEnemy_SetMaximumDamage(enm2, 2000);
enm3 = ObjEnemy_Create(OBJ_ENEMY);
ObjEnemy_Regist(enm3);
//SetIntersectionVisualization(true);
//let imgExRumia = GetModuleDirectory() ~ "script/ExRumia/ExRumia.png";
ObjPrim_SetTexture(enm3, imgExRumia);
ObjSprite2D_SetSourceRect(enm3, 64, 1, 127, 64);
ObjSprite2D_SetDestCenter(enm3);
ObjRender_SetScaleXYZ(enm3, 1.5, 1.5, 1);
ObjRender_SetColor(enm3, 0xFF8383);
ObjMove_SetDestAtFrame(enm3, STG_WIDTH/2, 50, 1);
ObjEnemy_SetMaximumDamage(enm3, 2000);
ObjEnemy_SetMaximumDamage(bossObj, 2000);
main;
display;
TFinalize;
}
@MainLoop{
ObjEnemy_SetIntersectionCircleToShot(bossObj,ObjMove_GetX(bossObj),ObjMove_GetY(bossObj),128);
ObjEnemy_SetIntersectionCircleToShot(enm2,ObjMove_GetX(enm2),ObjMove_GetY(enm2),128);
ObjEnemy_SetIntersectionCircleToShot(enm3,ObjMove_GetX(enm3),ObjMove_GetY(enm3),128);
//ObjEnemy_SetIntersectionCircleToPlayer(bossObj,ObjMove_GetX(bossObj),ObjMove_GetY(bossObj),32);
timer++;
timer2++;
x = ObjMove_GetX(bossObj);
y = ObjMove_GetY(bossObj);
ObjRender_SetAngleZ(bossObj,image_angle);
//main;
yield;
}
task TFinalize {
while(ObjEnemy_GetInfo(bossObj, INFO_LIFE) > 0){yield;}
Obj_Delete(bossObj);
DeleteShotAll(TYPE_ALL, TYPE_IMMEDIATE);
SetAutoDeleteObject(true);
CloseScript(GetOwnScriptID());
return;
}
task display {
let objText = CreateTextObject(100,300, 24, "Release SHOT to start testing DPS.");
let objMain = CreateTextObject(100,400, 24, "Avg DPS (Front): [r]Frames: ");
let objMain2 = CreateTextObject(100,500, 24, "Avg DPS (Middle): ");
let objMain3 = CreateTextObject(100,600, 24, "Avg DPS (Back): ");
loop {
ObjText_SetText(objText, gl_TutorialStr);
ObjText_SetText(objMain, StringFormat("Avg DPS (Front): %f[r]Frames: %d", "fd", gl_curDPS, gl_TimeSpent));
ObjText_SetText(objMain2, StringFormat("Avg DPS (Middle): %f", "f", gl_curDPS2));
ObjText_SetText(objMain3, StringFormat("Avg DPS (Back): %f", "f", gl_curDPS3));
yield;
}
}
// thanks wish
task main {
let count = 0;
let damage = 0;
let damage2 = 0;
let damage3 = 0;
loop {
//Reinitialize
count = 0;
damage = 0;
damage2 = 0;
damage3 = 0;
ObjEnemy_SetLife(bossObj, HP);
ObjEnemy_SetLife(enm2, HP);
ObjEnemy_SetLife(enm3, HP);
gl_TutorialStr = STR_START;
//Wait for shot to not be held.
while(count < 60) {
if (CheckShotRelease) {
count++;
}
else {
count = 0;
}
yield;
}
//Wait until player starts pressing SHOT.
count = 0;
gl_TutorialStr = STR_GO;
while(!CheckShotHeld) {
yield;
}
while(CheckShotHeld) {
count++;
damage += (HP - ObjEnemy_GetInfo(bossObj, INFO_LIFE));
damage2 += (HP - ObjEnemy_GetInfo(enm2, INFO_LIFE));
damage3 += (HP - ObjEnemy_GetInfo(enm3, INFO_LIFE));
ObjEnemy_SetLife(bossObj, HP);
ObjEnemy_SetLife(enm2, HP);
ObjEnemy_SetLife(enm3, HP);
gl_TimeSpent = count;
if (count % 60 == 0) {
gl_curDPS = damage;
gl_curDPS2 = damage2;
gl_curDPS3 = damage3;
gl_TutorialStr = STR_FINISH;
damage = 0;
damage2 = 0;
damage3 = 0;
}
yield;
}
}
}
function CheckShotRelease {
return ((GetVirtualKeyState(VK_SHOT) == KEY_PULL) || (GetVirtualKeyState(VK_SHOT) == KEY_FREE));
}
function CheckShotHeld {
return ((GetVirtualKeyState(VK_SHOT) == KEY_PUSH) || (GetVirtualKeyState(VK_SHOT) == KEY_HOLD));
}
//mkm fxn
function CreateTextObject(let mx, let my, let size, let text)
{
let obj = ObjText_Create();
ObjText_SetText(obj, text);
ObjText_SetFontSize(obj, size);
ObjText_SetFontBold(obj, true);
ObjText_SetFontColorTop(obj, 128, 128, 255);
ObjText_SetFontColorBottom(obj, 64, 64, 255);
ObjText_SetFontBorderType(obj, BORDER_FULL);
ObjText_SetFontBorderColor(obj,255, 255, 255);
ObjText_SetFontBorderWidth(obj, 2);
Obj_SetRenderPriorityI(obj, 10);
ObjRender_SetX(obj, mx);
ObjRender_SetY(obj, my);
return obj;
}