combat forecast, baby

This commit is contained in:
the me 2022-08-22 23:49:38 -07:00
parent 5ba3169744
commit 4dbbea31e4
8 changed files with 49 additions and 13 deletions

View File

@ -15,6 +15,7 @@ waiting = false;
targeting = new vec2(0, 0); targeting = new vec2(0, 0);
hitpos = new vec2(0, 0); hitpos = new vec2(0, 0);
marked = false; marked = false;
hitting = noone;
continuecombat = function(me, them) { continuecombat = function(me, them) {
//if stamina returnable = true stamina-- return true //if stamina returnable = true stamina-- return true
@ -28,7 +29,7 @@ continuecombat = function(me, them) {
action = { action = {
effect: function(me, them) { effect: function(me, them) {
if irandom(99) < (me.data.hit.val) { //add avo if irandom(99) < (me.data.hit.val) { //add avo
them.data.hp.val -= me.data.str.val; them.data.hp.val -= (me.data.str.val-them.data.def.val);
return me.data.str.val; return me.data.str.val;
} else { } else {
log(string(me) + " missed!"); log(string(me) + " missed!");

View File

@ -12,7 +12,7 @@ var tempy = y;
x = 0; x = 0;
y = 0; y = 0;
draw_self(); draw_self();
drawstate();
x = tempx; x = tempx;
y = tempy; y = tempy;
//log(data); //log(data);

View File

@ -0,0 +1 @@
drawstate();

View File

@ -21,6 +21,7 @@
{"isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, {"isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",},
{"isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, {"isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",},
{"isDnD":false,"eventNum":0,"eventType":8,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, {"isDnD":false,"eventNum":0,"eventType":8,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",},
{"isDnD":false,"eventNum":64,"eventType":8,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",},
], ],
"properties": [], "properties": [],
"overriddenProperties": [], "overriddenProperties": [],

View File

@ -1,6 +1,7 @@
function c_moveunit(targetunit, destination) { function c_moveunit(targetunit, destination) {
var theguy = c_gettile(targetunit.pos.x, targetunit.pos.y); var theguy = c_gettile(targetunit.pos.x, targetunit.pos.y);
array_remove(theguy.contents, targetunit); log(theguy.contents);
if !array_remove(theguy.contents, targetunit) idhfnjg();
array_push(destination.contents, targetunit); array_push(destination.contents, targetunit);
targetunit.pos.x = destination.x; targetunit.pos.x = destination.x;
targetunit.pos.y = destination.y; targetunit.pos.y = destination.y;

View File

@ -99,7 +99,7 @@ function st_moving() {
} }
} }
} }
var hitting = noone; hitting = noone;
if guy != noone { if guy != noone {
hitting = c_gettile(guy.x+hitpos.x, guy.y+hitpos.y); hitting = c_gettile(guy.x+hitpos.x, guy.y+hitpos.y);
switch dir { switch dir {
@ -125,15 +125,15 @@ function st_moving() {
} }
if hitting != noone && stop c_colortile(hitting.x, hitting.y, c_red); if hitting != noone && stop c_colortile(hitting.x, hitting.y, c_red);
if hitting != noone && select && stop { if hitting != noone && select && stop {
log("found one"); //log("found one");
log(hitting.contents, hitting.x, hitting.y); //log(hitting.contents, hitting.x, hitting.y);
var i; var i;
for (i=0; i<array_length(hitting.contents); i++) { for (i=0; i<array_length(hitting.contents); i++) {
if instance_exists(hitting.contents[i]) { if instance_exists(hitting.contents[i]) {
log("is instance"); //log("is instance");
if hitting.contents[i].object_index = o_unit { if hitting.contents[i].object_index = o_unit {
log("is unit"); //log("is unit");
log("found two"); //log("found two");
if hitting.contents[i].alignment != alignment ^^ !data.str.val { if hitting.contents[i].alignment != alignment ^^ !data.str.val {
c_moveunit(id, c_gettile(pos.x, pos.y)); c_moveunit(id, c_gettile(pos.x, pos.y));
c_generatecombatstack([id, hitting.contents[i]]); c_generatecombatstack([id, hitting.contents[i]]);
@ -187,6 +187,38 @@ function st_movingdraw() {
} }
} }
draw_set_alpha(1);*/ draw_set_alpha(1);*/
if hitting != noone && stop {
var i;
for (i=0; i<array_length(hitting.contents); i++) {
if instance_exists(hitting.contents[i]) {
if hitting.contents[i].object_index = o_unit {
if hitting.contents[i].alignment != alignment ^^ !data.str.val {
var them = hitting.contents[i];
draw_sprite_ext(s_box, 0, 320-120, 360, 8, -4, 0, c_white, 1);
draw_set_color(c_white);
draw_set_halign(fa_center);
//draw_set_valign(fa_middle);
draw_text(320-60, 245, data.name);
draw_text(320, 245, "VS");
draw_text_ext(320+60, 245, them.data.name, 14, 80);
draw_text(320-60, 280, string(data.str.val - them.data.def.val) + (data.spd.val > them.data.spd.val+5 ? " x 2" : ""));
draw_text(320, 280, "POW");
draw_text(320+60, 280, string(them.data.str.val - data.def.val) + (them.data.spd.val > data.spd.val+5 ? " x 2" : ""));
draw_text(320-60, 315, data.hit.val);
draw_text(320, 315, "HIT");
draw_text(320+60, 315, them.data.hit.val);
draw_set_halign(fa_left);
draw_set_valign(fa_top);
}
}
}
}
}
} }
#macro ts global.tilesize #macro ts global.tilesize

View File

@ -47,7 +47,7 @@ nu weapon("Lunar Machete", "sick", WPTYPE.SWORD, [new statmod(st.str, 9, add), n
nu weapon("Glock", "gang shit", WPTYPE.SWORD, [new statmod(st.str, 4, add), new statmod(st.hit, 95, add)]); nu weapon("Glock", "gang shit", WPTYPE.SWORD, [new statmod(st.str, 4, add), new statmod(st.hit, 95, add)]);
nu weapon("Sniper Rifle", "gang shit", WPTYPE.SWORD, [new statmod(st.str, 11, add), new statmod(st.hit, 100, add)]); nu weapon("Sniper Rifle", "gang shit", WPTYPE.SWORD, [new statmod(st.str, 11, add), new statmod(st.hit, 100, add)]);
nu weapon("Bottle", "it was full, just a minute ago...", WPTYPE.SWORD, [new statmod(st.str, 10, add), new statmod(st.hit, 30, add)]); nu weapon("Bottle", "it was full, just a minute ago...", WPTYPE.SWORD, [new statmod(st.str, 10, add), new statmod(st.hit, 33, add)]);
function c_modifierreset(target) { function c_modifierreset(target) {
var dudes = variable_struct_get_names(target.data); var dudes = variable_struct_get_names(target.data);

View File

@ -64,7 +64,7 @@ mydata = {
face: s_bunnyface, face: s_bunnyface,
aitype: AI.KILLER, aitype: AI.KILLER,
} }
nu unit(mydata, mydata, [st.hp.add(25), st.str.add(6), st.def.add(7), st.spd.add(6), st.mov.add(4), st.hit.add(0), st.rng.add(1)]); nu unit(mydata, mydata, [st.hp.add(25), st.str.add(6), st.def.add(7), st.spd.add(6), st.mov.add(2), st.hit.add(0), st.rng.add(1)]);
mydata = { mydata = {
name: "Plains Bunny", name: "Plains Bunny",
desc: "", desc: "",
@ -75,7 +75,7 @@ mydata = {
face: s_bunnyface, face: s_bunnyface,
aitype: AI.KILLER, aitype: AI.KILLER,
} }
nu unit(mydata, mydata, [st.hp.add(25), st.str.add(6), st.def.add(7), st.spd.add(6), st.mov.add(4), st.hit.add(0), st.rng.add(1)]); nu unit(mydata, mydata, [st.hp.add(25), st.str.add(6), st.def.add(7), st.spd.add(6), st.mov.add(2), st.hit.add(0), st.rng.add(1)]);
mydata = { mydata = {
name: "Mountain Bunny", name: "Mountain Bunny",
desc: "", desc: "",
@ -86,7 +86,7 @@ mydata = {
face: s_bunnyface, face: s_bunnyface,
aitype: AI.KILLER, aitype: AI.KILLER,
} }
nu unit(mydata, mydata, [st.hp.add(25), st.str.add(6), st.def.add(7), st.spd.add(6), st.mov.add(4), st.hit.add(0), st.rng.add(1)]); nu unit(mydata, mydata, [st.hp.add(25), st.str.add(6), st.def.add(7), st.spd.add(6), st.mov.add(2), st.hit.add(0), st.rng.add(1)]);
mydata = { mydata = {
name: "Bunny Buddy", name: "Bunny Buddy",
desc: "", desc: "",