Cirno2022/script/game/Boss_Plural.dnh

134 lines
2.9 KiB
Plaintext

#TouhouDanmakufu[Plural]
#ScriptVersion[3]
#Title["Boss Plural"]
#Text["..."]
#System["script/KevinSystem/Kevin_System.txt"]
//#Player["script/KevinPackage/KevinScript_Players/PankevKouda/KevKou_Main.dnh", "script/KevinPackage/KevinScript_Players/MariHousui/MariHousui_Main.dnh"]
let csd = GetCurrentScriptDirectory();
let obj = ObjEnemyBossScene_Create();
int objBGM = ObjSound_Create();
#include "script/KevinSystem/Universal_Lib.txt"
#include "script/game/Stage_Background.dnh"
int LifeStart = GetCommonData("Starting Lives", 3);
bool bossTrueStart = false;
float BGMRate = GetAreaCommonData("Config", "BGMVol", 100) * 0.01;
@Event{
alternative (GetEventType())
case(EV_PAUSE_ENTER){
if (bossTrueStart) {ObjSound_Stop(objBGM);}
}
case(EV_PAUSE_LEAVE){
if (bossTrueStart) {ObjSound_Play(objBGM);}
}
}
@Initialize{
SetCommonData("Flying Defeated", 0);
SetCommonData("Ground Defeated", 0);
//SetCommonData("IsBomb", false);
SetCommonData("Rank", 1);
if(!IsCommonDataAreaExists("PIV")){
CreateCommonDataArea("PIV");
SetAreaCommonData("PIV", "currentvalue", 10000);
}
else{}
SetPlayerLife(GetAreaCommonData("Config", "StartingLife", 3));
SetAutoDeleteObject(true);
// 0: Yal, 1: Wareya
//SetAreaCommonData("Config", "BGMSelect", "Wareya");
if(GetAreaCommonData("Config", "BGMSelect", 0) == 1){
ObjSound_Load(objBGM, "script/game/resourceLib/BossTheme_Wareya1.ogg");
ObjSound_SetLoopTime(objBGM, 1.644, 51.110);
}
else{
ObjSound_Load(objBGM, "script/game/resourceLib/BossTheme_Yal.ogg");
ObjSound_SetLoopTime(objBGM, 0.001, 92.81);
}
ObjSound_SetSoundDivision(objBGM, SOUND_BGM);
ObjSound_SetResumeEnable(objBGM, true);
ObjSound_SetLoopEnable(objBGM, true);
//ObjSound_SetLoopTime(objBGM, 0.00, 89.618);
ObjSound_SetVolumeRate(objBGM, 60*BGMRate);
PluralTask();
}
@MainLoop{
yield;
}
@Finalize
{
}
/* TO DO:
+ Single *syncing* - ensure that the boss stays at the same position
*/
// Task to handle the plural's boss scene
task PluralTask(){
// Registering individual singles
ObjEnemyBossScene_Add(obj, 0, csd ~ "99Sec.dnh");
ObjEnemyBossScene_LoadInThread(obj);
_ScrollBackground();
// Loading and registering the boss scene
ObjEnemyBossScene_Regist(obj);
bossTrueStart = true;
ObjSound_Play(objBGM);
async{
while(GetPlayerState() != STATE_END){yield;}
ObjSound_Stop(objBGM);
}
while(!Obj_IsDeleted(obj)){
yield;
}
ObjSound_Stop(objBGM);
bossTrueStart = false;
//_ExplosionEffect(GetCommonData("Boss Position X", STG_WIDTH/2), GetCommonData("Boss Position Y", STG_WIDTH/2), PetalEffect);
if(!IsReplay() & LifeStart <= 3){
int highScore = GetAreaCommonData("Data", "High Score", 0);
int curScore = GetCommonData("Run Score", 0);
if(curScore > highScore){SetAreaCommonData("Data", "High Score", curScore);}
else{}
}
SaveCommonDataAreaA2("Data", "script/game/data.dat");
SetAutoDeleteObject(true);
wait(60);
CloseScript(GetOwnScriptID());
}