Skip to content

Commit 76113d2

Browse files
committed
Im (really) feeling lucky (too)
1 parent c5bb911 commit 76113d2

File tree

2 files changed

+165
-1
lines changed

2 files changed

+165
-1
lines changed

(10)trymemode.stormmap/base.stormdata/Modules/LibFunny.galaxy

Lines changed: 165 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const int libFUNY_gv_randomEffectLength = 16;
1313
struct libFUNY_gs_Whatishappening {
1414
string[libFUNY_gv_randomEffectLength + 1] lv_randomEffectList;
1515
bool lv_randomBigger;
16+
bool lv_randomSmaller;
1617
bool lv_randomStopAnimation;
1718
};
1819

@@ -30,6 +31,8 @@ trigger libFUNY_gt_initRandomEffects;
3031
trigger libFUNY_gt_ToggleWhatisHappening;
3132
trigger libFUNY_gt_WhatisHappening;
3233
trigger libFUNY_gt_Imfeelinglucky;
34+
trigger libFUNY_gt_ImfeelingluckytooActuallyrandomeffects;
35+
trigger libFUNY_gt_ImreallyfeelingluckyActuallyrandombehavours;
3336

3437
// Library Initialization
3538
void libFUNY_InitVariables ();
@@ -298,6 +301,10 @@ bool libFUNY_gt_WhatisHappening_Func (bool testConds, bool runActions) {
298301
libFUNY_gv_whatishappening.lv_randomBigger = !(libFUNY_gv_whatishappening.lv_randomBigger);
299302
}
300303

304+
if ((lv_random == 4)) {
305+
libFUNY_gv_whatishappening.lv_randomSmaller = !(libFUNY_gv_whatishappening.lv_randomSmaller);
306+
}
307+
301308
auto3A47B911_g = UnitGroup(null, c_playerAny, RegionEntireMap(), UnitFilter(0, 0, 0, (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
302309
auto3A47B911_u = UnitGroupCount(auto3A47B911_g, c_unitCountAll);
303310
for (;; auto3A47B911_u -= 1) {
@@ -396,7 +403,12 @@ bool libFUNY_gt_WhatisHappening_Func (bool testConds, bool runActions) {
396403
UnitSetScale(lv_unit, 200.0, 200.0, 200.0);
397404
}
398405
else {
399-
UnitSetScale(lv_unit, 100.0, 100.0, 100.0);
406+
if ((libFUNY_gv_whatishappening.lv_randomSmaller == true)) {
407+
UnitSetScale(lv_unit, 35.0, 35.0, 35.0);
408+
}
409+
else {
410+
UnitSetScale(lv_unit, 100.0, 100.0, 100.0);
411+
}
400412
}
401413
if ((lv_random == 3)) {
402414
UnitCreateEffectUnit(UnitGroupUnit(UnitGroupAlliance(UnitGetOwner(lv_unit), c_unitAllianceEnemy, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 1), 1), (libFUNY_gv_whatishappening.lv_randomEffectList[RandomInt(0, libFUNY_gv_randomEffectLength)]), lv_unit);
@@ -448,6 +460,156 @@ void libFUNY_gt_Imfeelinglucky_Init () {
448460
TriggerAddEventChatMessage(libFUNY_gt_Imfeelinglucky, c_playerAny, "Im feeling lucky", true);
449461
}
450462

463+
//--------------------------------------------------------------------------------------------------
464+
// Trigger: Im feeling lucky too (Actually random effects)
465+
//--------------------------------------------------------------------------------------------------
466+
bool libFUNY_gt_ImfeelingluckytooActuallyrandomeffects_Func (bool testConds, bool runActions) {
467+
// Variable Declarations
468+
int lv__eachUnitInListIdx;
469+
unit[1001] lv_unitList;
470+
string[1001] lv__randomEffects;
471+
int lv__i;
472+
int lv__effectCounter;
473+
int[1001] lv__randomEffectIdx;
474+
int lv_totalEffectCount;
475+
string lv_random;
476+
unit lv_unit;
477+
478+
// Automatic Variable Declarations
479+
int auto24AE23FC_catalog;
480+
int auto24AE23FC_i;
481+
unitgroup auto3407F4A0_g;
482+
int auto3407F4A0_u;
483+
int autoB75E1AFF_catalog;
484+
int autoB75E1AFF_i;
485+
const int autoFBB36FF0_ae = 1000;
486+
const int autoFBB36FF0_ai = 1;
487+
const int auto039C0677_ae = 1000;
488+
const int auto039C0677_ai = 1;
489+
490+
// Variable Initialization
491+
492+
// Actions
493+
if (!runActions) {
494+
return true;
495+
}
496+
497+
auto24AE23FC_catalog = c_gameCatalogEffect;
498+
auto24AE23FC_i = 1;
499+
for ( ; auto24AE23FC_i <= CatalogEntryCount(c_gameCatalogEffect) ; auto24AE23FC_i += 1 ) {
500+
lv_random = CatalogEntryGet(auto24AE23FC_catalog, auto24AE23FC_i);
501+
lv_totalEffectCount = (lv_totalEffectCount + 1);
502+
}
503+
auto3407F4A0_g = UnitGroup(null, c_playerAny, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterStructure) | (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
504+
auto3407F4A0_u = UnitGroupCount(auto3407F4A0_g, c_unitCountAll);
505+
for (;; auto3407F4A0_u -= 1) {
506+
lv_unit = UnitGroupUnitFromEnd(auto3407F4A0_g, auto3407F4A0_u);
507+
if (lv_unit == null) { break; }
508+
lv_unitList[lv__i] = lv_unit;
509+
lv__randomEffectIdx[lv__i] = RandomInt(0, lv_totalEffectCount);
510+
lv__i = (lv__i + 1);
511+
}
512+
autoB75E1AFF_catalog = c_gameCatalogEffect;
513+
autoB75E1AFF_i = 1;
514+
for ( ; autoB75E1AFF_i <= CatalogEntryCount(c_gameCatalogEffect) ; autoB75E1AFF_i += 1 ) {
515+
lv_random = CatalogEntryGet(autoB75E1AFF_catalog, autoB75E1AFF_i);
516+
lv__eachUnitInListIdx = 0;
517+
for ( ; ( (autoFBB36FF0_ai >= 0 && lv__eachUnitInListIdx <= autoFBB36FF0_ae) || (autoFBB36FF0_ai < 0 && lv__eachUnitInListIdx >= autoFBB36FF0_ae) ) ; lv__eachUnitInListIdx += autoFBB36FF0_ai ) {
518+
if ((lv__randomEffectIdx[lv__eachUnitInListIdx] == lv__effectCounter)) {
519+
lv__randomEffects[lv__eachUnitInListIdx] = lv_random;
520+
}
521+
522+
}
523+
lv__effectCounter = (lv__effectCounter + 1);
524+
}
525+
lv__eachUnitInListIdx = 0;
526+
for ( ; ( (auto039C0677_ai >= 0 && lv__eachUnitInListIdx <= auto039C0677_ae) || (auto039C0677_ai < 0 && lv__eachUnitInListIdx >= auto039C0677_ae) ) ; lv__eachUnitInListIdx += auto039C0677_ai ) {
527+
UnitCreateEffectUnit(UnitGroupUnit(UnitGroupAlliance(UnitGetOwner(lv_unitList[lv__eachUnitInListIdx]), c_unitAllianceEnemy, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 1), 1), lv__randomEffects[lv__eachUnitInListIdx], lv_unitList[lv__eachUnitInListIdx]);
528+
}
529+
return true;
530+
}
531+
532+
//--------------------------------------------------------------------------------------------------
533+
void libFUNY_gt_ImfeelingluckytooActuallyrandomeffects_Init () {
534+
libFUNY_gt_ImfeelingluckytooActuallyrandomeffects = TriggerCreate("libFUNY_gt_ImfeelingluckytooActuallyrandomeffects_Func");
535+
TriggerAddEventChatMessage(libFUNY_gt_ImfeelingluckytooActuallyrandomeffects, c_playerAny, "Im feeling lucky too", true);
536+
}
537+
538+
//--------------------------------------------------------------------------------------------------
539+
// Trigger: Im really feeling lucky (Actually random behavours)
540+
//--------------------------------------------------------------------------------------------------
541+
bool libFUNY_gt_ImreallyfeelingluckyActuallyrandombehavours_Func (bool testConds, bool runActions) {
542+
// Variable Declarations
543+
int lv__eachUnitInListIdx;
544+
unit[1001] lv_unitList;
545+
string[1001] lv__randomBehaviours;
546+
int lv__i;
547+
int lv__effectCounter;
548+
int[1001] lv__randomBehavourIdx;
549+
int lv_totalBehaviourCount;
550+
string lv_random;
551+
unit lv_unit;
552+
553+
// Automatic Variable Declarations
554+
int autoAFB1B6A3_catalog;
555+
int autoAFB1B6A3_i;
556+
unitgroup auto273D059F_g;
557+
int auto273D059F_u;
558+
int auto62FABA49_catalog;
559+
int auto62FABA49_i;
560+
const int autoF0C07545_ae = 1000;
561+
const int autoF0C07545_ai = 1;
562+
const int auto56744631_ae = 1000;
563+
const int auto56744631_ai = 1;
564+
565+
// Variable Initialization
566+
567+
// Actions
568+
if (!runActions) {
569+
return true;
570+
}
571+
572+
autoAFB1B6A3_catalog = c_gameCatalogBehavior;
573+
autoAFB1B6A3_i = 1;
574+
for ( ; autoAFB1B6A3_i <= CatalogEntryCount(c_gameCatalogBehavior) ; autoAFB1B6A3_i += 1 ) {
575+
lv_random = CatalogEntryGet(autoAFB1B6A3_catalog, autoAFB1B6A3_i);
576+
lv_totalBehaviourCount = (lv_totalBehaviourCount + 1);
577+
}
578+
auto273D059F_g = UnitGroup(null, c_playerAny, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterStructure) | (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
579+
auto273D059F_u = UnitGroupCount(auto273D059F_g, c_unitCountAll);
580+
for (;; auto273D059F_u -= 1) {
581+
lv_unit = UnitGroupUnitFromEnd(auto273D059F_g, auto273D059F_u);
582+
if (lv_unit == null) { break; }
583+
lv_unitList[lv__i] = lv_unit;
584+
lv__randomBehavourIdx[lv__i] = RandomInt(0, lv_totalBehaviourCount);
585+
lv__i = (lv__i + 1);
586+
}
587+
auto62FABA49_catalog = c_gameCatalogBehavior;
588+
auto62FABA49_i = 1;
589+
for ( ; auto62FABA49_i <= CatalogEntryCount(c_gameCatalogBehavior) ; auto62FABA49_i += 1 ) {
590+
lv_random = CatalogEntryGet(auto62FABA49_catalog, auto62FABA49_i);
591+
lv__eachUnitInListIdx = 0;
592+
for ( ; ( (autoF0C07545_ai >= 0 && lv__eachUnitInListIdx <= autoF0C07545_ae) || (autoF0C07545_ai < 0 && lv__eachUnitInListIdx >= autoF0C07545_ae) ) ; lv__eachUnitInListIdx += autoF0C07545_ai ) {
593+
if ((lv__randomBehavourIdx[lv__eachUnitInListIdx] == lv__effectCounter)) {
594+
lv__randomBehaviours[lv__eachUnitInListIdx] = lv_random;
595+
}
596+
597+
}
598+
lv__effectCounter = (lv__effectCounter + 1);
599+
}
600+
lv__eachUnitInListIdx = 0;
601+
for ( ; ( (auto56744631_ai >= 0 && lv__eachUnitInListIdx <= auto56744631_ae) || (auto56744631_ai < 0 && lv__eachUnitInListIdx >= auto56744631_ae) ) ; lv__eachUnitInListIdx += auto56744631_ai ) {
602+
UnitBehaviorAdd(lv_unitList[lv__eachUnitInListIdx], lv__randomBehaviours[lv__eachUnitInListIdx], UnitGroupUnit(UnitGroupAlliance(UnitGetOwner(lv_unitList[lv__eachUnitInListIdx]), c_unitAllianceEnemy, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 1), 1), 1);
603+
}
604+
return true;
605+
}
606+
607+
//--------------------------------------------------------------------------------------------------
608+
void libFUNY_gt_ImreallyfeelingluckyActuallyrandombehavours_Init () {
609+
libFUNY_gt_ImreallyfeelingluckyActuallyrandombehavours = TriggerCreate("libFUNY_gt_ImreallyfeelingluckyActuallyrandombehavours_Func");
610+
TriggerAddEventChatMessage(libFUNY_gt_ImreallyfeelingluckyActuallyrandombehavours, c_playerAny, "Im really feeling lucky", true);
611+
}
612+
451613
void libFUNY_InitTriggers () {
452614
libFUNY_gt_MapInit_Init();
453615
libFUNY_gt_GreetingModeOutput_Init();
@@ -457,6 +619,8 @@ void libFUNY_InitTriggers () {
457619
libFUNY_gt_ToggleWhatisHappening_Init();
458620
libFUNY_gt_WhatisHappening_Init();
459621
libFUNY_gt_Imfeelinglucky_Init();
622+
libFUNY_gt_ImfeelingluckytooActuallyrandomeffects_Init();
623+
libFUNY_gt_ImreallyfeelingluckyActuallyrandombehavours_Init();
460624
}
461625

462626
//--------------------------------------------------------------------------------------------------
Binary file not shown.

0 commit comments

Comments
 (0)