mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-16 11:16:42 -04:00
little adjustments in battle system
This commit is contained in:
parent
3d8ee275e4
commit
07ba4802f4
3 changed files with 51 additions and 44 deletions
|
@ -281,7 +281,11 @@ static __inline int rangrnd(int a, int b) {return rnd(b-a+1)+a;}
|
||||||
|
|
||||||
#define SAVE_NAME_SIZE 32
|
#define SAVE_NAME_SIZE 32
|
||||||
|
|
||||||
#define mgochrana(x) (100-(x))
|
static inline int mgochrana(int x) {
|
||||||
|
if (x > 100) return 100;
|
||||||
|
return 100-x;
|
||||||
|
}
|
||||||
|
//#define mgochrana(x) (100-(x))
|
||||||
//#define mgochrana(x) (1000/(10+(x)))
|
//#define mgochrana(x) (1000/(10+(x)))
|
||||||
|
|
||||||
//typy sektoru
|
//typy sektoru
|
||||||
|
|
49
game/inv.c
49
game/inv.c
|
@ -2049,30 +2049,20 @@ int weigth_defect(THUMAN *p)
|
||||||
return wf;
|
return wf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char check_double_wield(int newplace,short item)
|
static char check_double_wield() {
|
||||||
{
|
short i1 = human_selected->wearing[PO_RUKA_L];
|
||||||
short *p,i,*q1,*q2;
|
short i2 = human_selected->wearing[PO_RUKA_R];
|
||||||
short *z1,*z2;
|
if (!i1 || !i2) return 0;
|
||||||
short opplace=newplace==PO_RUKA_L?PO_RUKA_R:PO_RUKA_L;
|
const TITEM *it1 = glob_items+i1;
|
||||||
short item2=human_selected->wearing[opplace];
|
const TITEM *it2 = glob_items+i2;
|
||||||
|
for (int i = VLS_SILA; i <=VLS_OBRAT; ++i) {
|
||||||
if (!item || !item2) return 0;
|
if ((it1->podminky[i] + it2->podminky[i] > human_selected->vlastnosti[i])
|
||||||
if (glob_items[item-1].druh!=TYP_UTOC || glob_items[item2-1].druh!=TYP_UTOC ) return 0;
|
&& (MAX(it1->podminky[i], it2->podminky[i]) > human_selected->vlastnosti[VLS_OBRAT])) {
|
||||||
p=human_selected->vlastnosti;
|
return 1;
|
||||||
q1=glob_items[item-1].podminky;
|
}
|
||||||
q2=glob_items[item2-1].podminky;
|
}
|
||||||
z1=glob_items[item-1].zmeny;
|
return 0;
|
||||||
z2=glob_items[item2-1].zmeny;
|
}
|
||||||
for(i=0;i<4;i++)
|
|
||||||
{
|
|
||||||
int chk=(*q1+*q2)-(human_selected->vlastnosti[VLS_OBRAT]/2); //cim vyssi obratnost tim spis double wield
|
|
||||||
if (*p<chk) return 1;
|
|
||||||
if (*p+*z1+*z2<chk) return 1;
|
|
||||||
q1++;p++;q2++;
|
|
||||||
z1++;z2++;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void zkontroluj_postavu()
|
void zkontroluj_postavu()
|
||||||
{
|
{
|
||||||
|
@ -2081,12 +2071,14 @@ void zkontroluj_postavu()
|
||||||
p=human_selected->wearing;
|
p=human_selected->wearing;
|
||||||
for(i=0;i<HUMAN_PLACES;i++,p++)
|
for(i=0;i<HUMAN_PLACES;i++,p++)
|
||||||
if (*p && !muze_nosit(p[0])) remove_item(human_selected,i);
|
if (*p && !muze_nosit(p[0])) remove_item(human_selected,i);
|
||||||
if (check_double_wield(PO_RUKA_R,human_selected->wearing[PO_RUKA_R]))
|
if (check_double_wield())
|
||||||
remove_item(human_selected,PO_RUKA_L);
|
remove_item(human_selected,PO_RUKA_L);
|
||||||
|
prepocitat_postavu(human_selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char human_click(int id,int xa,int ya,int xr,int yr)
|
char human_click(int id,int xa,int ya,int xr,int yr)
|
||||||
{
|
{
|
||||||
short itsave=0;
|
short itsave=0;
|
||||||
|
@ -2163,8 +2155,6 @@ char human_click(int id,int xa,int ya,int xr,int yr)
|
||||||
case PL_RUKA :if (place==PO_RUKA_L)
|
case PL_RUKA :if (place==PO_RUKA_L)
|
||||||
if (human_selected->wearing[PO_RUKA_R] && glob_items[human_selected->wearing[PO_RUKA_R]-1].umisteni==PL_OBOUR)
|
if (human_selected->wearing[PO_RUKA_R] && glob_items[human_selected->wearing[PO_RUKA_R]-1].umisteni==PL_OBOUR)
|
||||||
remove_item(human_selected,PO_RUKA_R);
|
remove_item(human_selected,PO_RUKA_R);
|
||||||
if (check_double_wield(place,*picked_item))
|
|
||||||
remove_item(human_selected,place==PO_RUKA_L?PO_RUKA_R:PO_RUKA_L);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
human_selected->wearing[place]=*picked_item;
|
human_selected->wearing[place]=*picked_item;
|
||||||
|
@ -2182,6 +2172,11 @@ char human_click(int id,int xa,int ya,int xr,int yr)
|
||||||
}
|
}
|
||||||
play_sample_at_channel(H_SND_WEAR,1,100);
|
play_sample_at_channel(H_SND_WEAR,1,100);
|
||||||
prepocitat_postavu(human_selected);
|
prepocitat_postavu(human_selected);
|
||||||
|
if (check_double_wield()) {
|
||||||
|
if (place == PO_RUKA_L) remove_item(human_selected, PO_RUKA_R);
|
||||||
|
else remove_item(human_selected, PO_RUKA_L);
|
||||||
|
prepocitat_postavu(human_selected);
|
||||||
|
}
|
||||||
zkontroluj_postavu();
|
zkontroluj_postavu();
|
||||||
pick_set_cursor();
|
pick_set_cursor();
|
||||||
inv_redraw();
|
inv_redraw();
|
||||||
|
|
|
@ -351,16 +351,17 @@ void zacni_souboj(TMOB *p,int d,short sector)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int vypocet_zasahu(short *utocnik,short *obrance, int chaos,int zbran,int bonusplus)
|
int vypocet_zasahu(short *utocnik,short *obrance, int chaos,int zbran,int external_force)
|
||||||
{
|
{
|
||||||
int zasah,mutok,flg;
|
int zasah,mutok,flg;
|
||||||
flg=obrance[VLS_KOUZLA];
|
flg=obrance[VLS_KOUZLA];
|
||||||
|
short attack_attribute = MAX(utocnik[VLS_SILA], utocnik[VLS_OBRAT]);
|
||||||
if (game_extras & EX_ALTERNATEFIGHT)
|
if (game_extras & EX_ALTERNATEFIGHT)
|
||||||
{
|
{
|
||||||
int postih=(chaos+1)/2;
|
int postih=(chaos+1)/2;
|
||||||
int testutok=rangrnd(utocnik[VLS_UTOK_L],utocnik[VLS_UTOK_H])+utocnik[VLS_OBRAT]/4+bonusplus;
|
int testutok=rangrnd(utocnik[VLS_UTOK_L],utocnik[VLS_UTOK_H])+utocnik[VLS_OBRAT]/4+external_force;
|
||||||
int testobrana=rangrnd(obrance[VLS_OBRAN_L],obrance[VLS_OBRAN_H])+obrance[VLS_OBRAT]/(4*postih)+(flg & SPL_INVIS?rangrnd(5,15):0);
|
int testobrana=rangrnd(obrance[VLS_OBRAN_L],obrance[VLS_OBRAN_H])+obrance[VLS_OBRAT]/(4*postih)+(flg & SPL_INVIS?rangrnd(5,15):0);
|
||||||
int utok=rangrnd(utocnik[VLS_UTOK_L],utocnik[VLS_UTOK_H])+utocnik[VLS_SILA]/10+bonusplus;
|
int utok=rangrnd(utocnik[VLS_UTOK_L],utocnik[VLS_UTOK_H])+attack_attribute/10+external_force;
|
||||||
int obrana=rangrnd(obrance[VLS_OBRAN_L],obrance[VLS_OBRAN_H])+obrance[VLS_OBRAT]/(10*postih);
|
int obrana=rangrnd(obrance[VLS_OBRAN_L],obrance[VLS_OBRAN_H])+obrance[VLS_OBRAT]/(10*postih);
|
||||||
int zv;
|
int zv;
|
||||||
mutok=rangrnd(utocnik[VLS_MGSIL_L],utocnik[VLS_MGSIL_H]);
|
mutok=rangrnd(utocnik[VLS_MGSIL_L],utocnik[VLS_MGSIL_H]);
|
||||||
|
@ -383,33 +384,40 @@ int vypocet_zasahu(short *utocnik,short *obrance, int chaos,int zbran,int bonus
|
||||||
{
|
{
|
||||||
int utok,obrana;
|
int utok,obrana;
|
||||||
int ospod;
|
int ospod;
|
||||||
int x,y,z,zv;
|
int attack_roll,defense_roll,mag_att_roll,mg_def;
|
||||||
|
|
||||||
chaos=(chaos+1)/2;
|
chaos=(chaos+1)/2; //chaos - pocet postav, 0=>1, 1=>1,2=>1,3=>2,4=>2,5=>3,6=>3
|
||||||
|
//nizsi obrana je snizena o pocet postav na poli
|
||||||
|
//0-2=>no change, 3-4=>/2, 5-6=>/3
|
||||||
ospod=obrance[VLS_OBRAN_L]/chaos;
|
ospod=obrance[VLS_OBRAN_L]/chaos;
|
||||||
x=rnd(utocnik[VLS_UTOK_H]-utocnik[VLS_UTOK_L]+1);
|
attack_roll=rnd(utocnik[VLS_UTOK_H]-utocnik[VLS_UTOK_L]+1);
|
||||||
y=rnd(obrance[VLS_OBRAN_H]-ospod+1);
|
defense_roll=rnd(obrance[VLS_OBRAN_H]-ospod+1);
|
||||||
z=rnd(utocnik[VLS_MGSIL_H]-utocnik[VLS_MGSIL_L]+1);
|
mag_att_roll=rnd(utocnik[VLS_MGSIL_H]-utocnik[VLS_MGSIL_L]+1);
|
||||||
dhit=utok=utocnik[VLS_UTOK_L]+x+(utocnik[VLS_SILA]*15+(utocnik[VLS_OBRAT])*10)/150+bonusplus;
|
|
||||||
obrana=ospod+y+(obrance[VLS_OBRAT]/5)+(flg & SPL_INVIS?10:0);
|
//hit=attack_roll+max(str,dex)+external_force
|
||||||
mutok=utocnik[VLS_MGSIL_L]+z;
|
dhit=utok=utocnik[VLS_UTOK_L]+attack_roll+attack_attribute/5+external_force;
|
||||||
zv=obrance[VLS_OHEN+utocnik[VLS_MGZIVEL]];
|
//def=defense_roll+dex/5+(10 if invisible)
|
||||||
zv=mgochrana(zv);
|
obrana=ospod+defense_roll+(obrance[VLS_OBRAT]/5)+(flg & SPL_INVIS?10:0);
|
||||||
mutok=zv*mutok/100;
|
//mg_attack = magic_roll
|
||||||
|
mutok=utocnik[VLS_MGSIL_L]+mag_att_roll;
|
||||||
|
//mg_deffense (100-x)
|
||||||
|
mg_def=mgochrana(obrance[VLS_OHEN+utocnik[VLS_MGZIVEL]]);
|
||||||
|
//adjust magic attack
|
||||||
|
mutok=mg_def*mutok/100;
|
||||||
dmzhit=mutok;
|
dmzhit=mutok;
|
||||||
zasah=utok-(ddef=obrana);
|
zasah=utok-(ddef=obrana);
|
||||||
}
|
}
|
||||||
if (zasah<0) zasah=0;
|
if (zasah<0) zasah=0;
|
||||||
if (zasah>0) zasah+=utocnik[VLS_DAMAGE],zasah=MAX(zasah,1);
|
if (zasah>0) zasah+=utocnik[VLS_DAMAGE],zasah=MAX(zasah,1);
|
||||||
ddostal=zasah;
|
ddostal=zasah;
|
||||||
|
if (flg & SPL_SANC) zasah/=2;
|
||||||
zasah=zasah+mutok;
|
zasah=zasah+mutok;
|
||||||
if (zasah>0)
|
if (zasah>0)
|
||||||
{
|
{
|
||||||
zasah+=zbran;
|
zasah+=zbran;
|
||||||
if (zasah<1) zasah=1;
|
if (zasah<1) zasah=1;
|
||||||
}
|
}
|
||||||
if (flg & SPL_SANC) zasah/=2;
|
if (flg & SPL_HSANC) zasah/=2;
|
||||||
if (flg & SPL_HSANC) zasah/=4;
|
|
||||||
if (flg & SPL_TVAR) zasah=-zasah;
|
if (flg & SPL_TVAR) zasah=-zasah;
|
||||||
return zasah;
|
return zasah;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue