Skip to content

Commit

Permalink
Rozšířeno item API
Browse files Browse the repository at this point in the history
  • Loading branch information
lofcz committed Nov 19, 2016
1 parent 14baa4c commit 16e2fdc
Show file tree
Hide file tree
Showing 10 changed files with 113 additions and 9 deletions.
3 changes: 3 additions & 0 deletions SimplexRPGEngine/Engine source/DragonRise3.project.gmx
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,9 @@
<script>scripts\scrItemBasic.gml</script>
<script>scripts\scrItemSetProperty.gml</script>
<script>scripts\scrItemSetBodyCanvas.gml</script>
<script>scripts\scrItemSetRarityPointsBased.gml</script>
<script>scripts\scrItemSetRarityDistributionBased.gml</script>
<script>scripts\scrItemGetRarity.gml</script>
<script>scripts\itemDraw.gml</script>
<script>scripts\itemDrawStats.gml</script>
<script>scripts\scrItemRarity.gml</script>
Expand Down
2 changes: 0 additions & 2 deletions SimplexRPGEngine/Engine source/objects/oArmorMetal.object.gmx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ scrItemSetBodyCanvas(2, sBodyCanvasArmor2, sBodyCanvasAttackArmor2);

scrItemSetUpFinalize();



</string>
</argument>
</arguments>
Expand Down
25 changes: 21 additions & 4 deletions SimplexRPGEngine/Engine source/objects/oRingGolden.object.gmx
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,27 @@ scrItemSetUp(0, 0, itemEnum.itemRingGolden);
scrItemSetProperties(false, "Zlatý prsten", "Prsten vypadá spíš jako nepříliš povedená slitina mědi a stříbra potažená vrstvičkou zlata. Nejspíš výrobek levnější třídy z dílny Nicolase Flamela.", materialEnum.materialNone, "ring", 60, rarity_normal, true, "", c_dkgray, 15, 15, 6);
scrItemSetOptions();

scrItemSetProperty(vlastnost_max_mana, 12);
scrItemSetProperty(vlastnost_dustojnost, 1);
scrItemSetProperty(vlastnost_inteligence, 1);
scrItemSetRarityDistributionBased(30, 20, 0, 0, 0, 50);

if (scrItemGetRarity() == rarity_junk)
{
scrItemSetProperty(vlastnost_max_mana, irandom_range(9, 12));
scrItemSetProperty(vlastnost_dustojnost, 1);
scrItemSetProperty(vlastnost_inteligence, 1);
}
if (scrItemGetRarity() == rarity_normal)
{
scrItemSetProperty(vlastnost_max_mana, irandom_range(14, 20));
scrItemSetProperty(vlastnost_dustojnost, 1);
scrItemSetProperty(vlastnost_inteligence, irandom_range(1, 2));
}
if (scrItemGetRarity() == rarity_legendary)
{
scrItemSetProperty(vlastnost_max_mana, irandom_range(30, 50));
scrItemSetProperty(vlastnost_dustojnost, irandom_range(2, 4));
scrItemSetProperty(vlastnost_inteligence, irandom_range(3, 5));
scrItemSetProperty(vlastnost_stesti, irandom_range(1, 5));
}
scrItemSetUpFinalize();
</string>
</argument>
Expand Down Expand Up @@ -64,7 +81,7 @@ if (loot = 0)
{
if (inventoryPickUp())
{
scrLog("+ Zlatý prsten",c_white,sRingEffect2,1,0.5);
scrLog("+ Zlatý prsten",c_white,sRingEffect2,true,0.5);
audio_play_sound(sndWeaponPickup,0,0);
}
}
Expand Down
2 changes: 1 addition & 1 deletion SimplexRPGEngine/Engine source/scripts/scrCraftingDraw.gml
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ else
}

}
// --> Occupied by satan <--
// --> Occupied by the devil <--
// Crafting details form (item to craft is selected)
if (craftingSelectedIndex == 4 && craftingHelper == 0 && !craftingDetails)
{
Expand Down
3 changes: 3 additions & 0 deletions SimplexRPGEngine/Engine source/scripts/scrItemGetRarity.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/// scrItemGetRarity()

return(itm_effect);
7 changes: 5 additions & 2 deletions SimplexRPGEngine/Engine source/scripts/scrItemSetProperty.gml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
/// scrItemSetProperty(index, value)
/// scrItemSetProperty(index, value, pointsValue)

var i, v;
var i, v, p;
i = 0;
v = 1;
p = 1;

if (argument_count > 0) {i = argument[0];}
if (argument_count > 1) {v = argument[1];}
if (argument_count > 2) {p = argument[2];}

vlastnost[i] = v;
points += (v * p);
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/// scrItemSetRarityDistributionBased(junk%, normal%, rare%, fine%, mythic%, legendary%)

var j, n, r, f, u, l, z;
j = 0;
n = -1;
r = -1;
f = -1;
u = -1;
l = -1;

if (argument_count > 0) {j = argument[0];}
if (argument_count > 1) {n = argument[1];}
if (argument_count > 2) {r = argument[2];}
if (argument_count > 3) {f = argument[3];}
if (argument_count > 4) {u = argument[4];}
if (argument_count > 5) {l = argument[5];}

// kawaii
jj = j; nn = n; rr = r; ff = f; uu = u; ll = l;

j = jj;
n = jj + nn;
r = jj + nn + rr;
f = jj + nn + rr + ff;
u = jj + nn + rr + ff + uu;
l = jj + nn + rr + ff + uu + ll;

z = random(100);

if (z <= j) {itm_effect = rarity_junk;}
else if (z > j && z <= n) {itm_effect = rarity_normal;}
else if (z > n && z <= r) {itm_effect = rarity_rare;}
else if (z > r && z <= f) {itm_effect = rarity_fine;}
else if (z > f && z <= u) {itm_effect = rarity_mythic;}
else if (z > u && z <= l) {itm_effect = rarity_legendary;}

itm_info_color = itm_effect;


Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/// scrItemSetRarityPointsBased(junk, normal, rare, fine, mythic, legendary)

var j, n, r, f, u, l;
j = 0;
n = -1;
r = -1;
f = -1;
u = -1;
l = -1;

if (argument_count > 0) {j = argument[0];}
if (argument_count > 1) {n = argument[1];}
if (argument_count > 2) {r = argument[2];}
if (argument_count > 3) {f = argument[3];}
if (argument_count > 4) {u = argument[4];}
if (argument_count > 5) {l = argument[5];}

if (l != -1 && points >= l) {itm_effect = rarity_legendary;}
else if (u != -1 && points >= u) {itm_effect = rarity_mythic;}
else if (f != -1 && points >= f) {itm_effect = rarity_fine;}
else if (r != -1 && points >= r) {itm_effect = rarity_rare;}
else if (n != -1 && points >= n) {itm_effect = rarity_normal;}
else {itm_effect = rarity_junk;}

itm_info_color = itm_effect;
1 change: 1 addition & 0 deletions SimplexRPGEngine/Engine source/scripts/scrItemSetUp.gml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ show_number = 0;
points = 0;
in = false;
canBeQuickUsed = false;
points = 0;

if (argument_count > 0) {animate = argument[0];}
if (argument_count > 1) {show_number = argument[1];}
Expand Down
15 changes: 15 additions & 0 deletions SimplexRPGEngine/Engine source/scripts/scrLog.gml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ if (override)
color = c_lime;
break;
}
case rarity_legendary:
{
color = c_yellow;
break;
}
case 6553600:
{
color = 6553600;
break;
}
case 4980889:
{
color = 4980889;
break;
}
}
}

Expand Down

0 comments on commit 16e2fdc

Please sign in to comment.