nb Core Community
May 22, 2012, 03:19:17 pm *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: 1.2.3 +nb is now final and released

@new registrations. I will not allow any new registrations here as there are more (real person) spambots here than ever.... captcha proved to be ineffective.

After your registration, mail me at ( admin AT shinobilegends.com ) from the mail address you want to register. Provide some text about you and possibly your game.
 
   Home   Help Search Calendar Downloads Login Register  
Pages: 1 [2]
  Print  
Author Topic: A modified generic race  (Read 2805 times)
Iori
Guest
« Reply #15 on: September 04, 2008, 07:23:45 am »

I know they are not different from creatures - except in exactly one point.
Normal forest creatures have their AI script hardcoded in /scripts lying idle, non-changeable except by somebody who can access and change files.

I know that this is also poor, and ai can be applied dynamically (same issues).

So it's my job to make it more sensible ... for instance make access safer.

You have plenty of items with unique eval()d code? Well, I don't, and you have to see that the item system intends to only set variables (that are standardized) and then does standardized actions. You can put anything in - and execute again code globally.

Item creators have bascially SU_MEGAUSER privileges =) great. =)

As said - first all variables that are now global like $session, $badguy and so on need to be replaced with objects where I can do

- logging of access
- restriction of access
- filtering of access
- alterations


I have no qualms with scripts being forced to be loaded from physical files (all my scripts are physical files anyway with a require/require_once) if it is deemed safer in an environment where more than one user has access to it. For example, restricting the buff to only supply the filename of the script, and the code handles the rest.

ANd I have no issues with converting stuff to objects, but...the four reasons you listed are all possible without OO
Logged
Nightborn
Administrator
Sr. Member
*****

Karma: +20/-0
Posts: 307



View Profile WWW
« Reply #16 on: September 04, 2008, 07:30:07 am »

Yes, I tend to make this file-based.
However, as I also do "clones of you as companion" it's tricky because the clones need to be updated with stats on runtime creation...

Quote
ANd I have no issues with converting stuff to objects, but...the four reasons you listed are all possible without OO

You can do OOP without OOP. That's possible.
But a real real PITA. And tons of global variables/functions that have no protection whatsoever =)
Logged

It should be fixed, but it won't be easy and it won't be fast. If you want
to help - wonderful. But keep in mind that it will take months of wading
through the ugliest code we have in the tree. If you've got a weak stomach -
stay out. I've been there and it's not a nice place.

   - Al Viro
Alchemion
Guest
« Reply #17 on: September 07, 2008, 10:03:57 am »

Hi,

I have moved the hook to battle and made the buff dissapear after fight...

Yet, as Nightborn stated, this buff is relatively a clone effect buff of other available modules, and making this a constant for ALL the players that keep a balance between their attack and defense, would be unbalancing for the game and not good for it...

Yet, there is a possibility to make this buff a special one, and a valid one for any lotgd engine, IF this buff will appear RANDOMLY, respectively to insert a code that randomizes the "awakening" of the CHI (the racial buff, in my case)...

So, please take a look at the modified code and please suggest what needs to be removed, as absolete, and what needs to be modified and added so that the buff would appear on the equality (attack and defense) condition met, PLUS the random "awakening" factor... many of us are striving for awakening, many are keeping a balance... but not all of us succeed... here, there is in issue the Grace factor that is given on unintelligible by us basis or, in other words intelligible for us, on random basis...

Thank you very much, for your help so far.

The battle hooked code inserted in the generic race is looking like this :

Code:
case "battle":
require_once("lib/playerfunctions.php");
require_once("lib/battle-buffs.php");
$atk=get_player_attack();
$def=get_player_defense();

if ($atk==$def) {
apply_buff("racialbenefit",array(
"startmsg"=>"`#Because you succeeded in balancing your attack and defense strengths, your Sacred Chi energy is awakening and is doubling your damage handling skills... ",
"name"=>"`#Sacred Chi`0",
"dmgmod" =>2,
"dmgshield" =>2,
"allowinpvp"=>1,
"allowintrain"=>1,
"rounds"=>99,
"expireafterfight"=>1,
"schema"=>"module-racegeneric",
)
);
}
break;
Logged
Alchemion
Guest
« Reply #18 on: September 08, 2008, 10:40:46 am »

I have tested the random factor and it seems that this is a bad idea in battle, where the buff can awake and at the next fight option it can dissapear again... kinda nasty...

so, i have moved the hook again to "newday" and it works fine now...

yet, i haven't tested too much, but is this code (below) producing any effect ?... there are involved more factors when calculating damage and i am not sure that this code is producing the effect as intended, for doubling the handled given and taken damage ... is it ?..

Code:
"dmgmod" =>2,
"dmgshield" =>2,

Thanks.
« Last Edit: September 08, 2008, 10:42:38 am by Alchemion » Logged
Nightborn
Administrator
Sr. Member
*****

Karma: +20/-0
Posts: 307



View Profile WWW
« Reply #19 on: September 08, 2008, 06:32:35 pm »

That buff is even worse.

You give the opponent twice the damage he hits the player.

And also double the players damage...

ouch.
Logged

It should be fixed, but it won't be easy and it won't be fast. If you want
to help - wonderful. But keep in mind that it will take months of wading
through the ugliest code we have in the tree. If you've got a weak stomach -
stay out. I've been there and it's not a nice place.

   - Al Viro
Alchemion
Guest
« Reply #20 on: September 09, 2008, 12:58:12 pm »

well, what is then the variable i should double so that it only applies positively to the player, not the badguy... ?? i am not sure who's whom...

sinthesys, please reply:
name for the variable/mod that handles the player's fighting ALL damage
name for the variable/mod that handles the badguy's fighting ALL damage

many thanks.
Logged
Nightborn
Administrator
Sr. Member
*****

Karma: +20/-0
Posts: 307



View Profile WWW
« Reply #21 on: September 09, 2008, 02:40:56 pm »

dmgmod

badguydmgmod

if you want to know what buff values are used in battle, see the lib/battle-buffs.php

Code:
12         $result['invulnerable'] = 0;
 13         $result['dmgmod'] = 1;
 14         $result['compdmgmod'] = 1;
 15         $result['badguydmgmod'] = 1;
 16         $result['atkmod'] = 1;
 17         $result['compatkmod'] = 1;
 18         $result['badguyatkmod'] = 1;
 19         $result['defmod'] = 1;
 20         $result['compdefmod'] = 1;
 21         $result['badguydefmod'] = 1;
 22         $result['lifetap'] = array();
 23         $result['dmgshield'] = array();

for instance.
Logged

It should be fixed, but it won't be easy and it won't be fast. If you want
to help - wonderful. But keep in mind that it will take months of wading
through the ugliest code we have in the tree. If you've got a weak stomach -
stay out. I've been there and it's not a nice place.

   - Al Viro
Alchemion
Guest
« Reply #22 on: September 09, 2008, 03:04:01 pm »

That lib is exactly where I took the "dmgshield" from ......

Yet, I "imagined" that "dmgshield" stands for capacity of the player to handle (to resist to) the damage inflicted by the badguy... the higher the dmgshield,  the less damage could the badguy inflict... it seems my imagination didn't help in this case...

so, if badguydmgmod is the damage made by the badguy... and I will make it on half (I suppose, to get the desired effect...), what "dmgshield" is standing for Huh?....

Thanks.
Logged
Nightborn
Administrator
Sr. Member
*****

Karma: +20/-0
Posts: 307



View Profile WWW
« Reply #23 on: September 09, 2008, 07:32:03 pm »

Code:
258 function process_dmgshield($dshield, $damage) {
259         global $session, $badguy;
260         tlschema("buffs");
261         reset($dshield);
262         foreach ($dshield as $buff) {
263                 if (isset($buff['suspended']) && $buff['suspended']) continue;
264                 if ($buff['schema']) tlschema($buff['schema']);
265                 $realdamage = round($damage * $buff['damageshield'], 0);
266                 if ($realdamage < 0) $realdamage = 0;
267                 $msg = "";
268                 if ($realdamage > 0) {
269                         if (isset($buff['effectmsg'])) $msg = $buff['effectmsg'];
270                 } else if ($realdamage == 0) {
271                         if (isset($buf['effectnodmgmsg'])) $msg = $buff['effectnodmgmsg'];
272                 } else if ($realdamage < 0) {
273                         if (isset($buff['effectfailmsg'])) $msg = $buff['effectfailmsg'];
274                 }
275                 $badguy['creaturehealth'] -= $realdamage;
276                 if ($badguy['creaturehealth'] <= 0) {
277                         $badguy['istarget'] = false;
278                         $badguy['dead'] = true;
279                         $count = 1;
280                 }

Your answer in the same file.

mind the line 265

and then 275

those are the interesting ones...
Logged

It should be fixed, but it won't be easy and it won't be fast. If you want
to help - wonderful. But keep in mind that it will take months of wading
through the ugliest code we have in the tree. If you've got a weak stomach -
stay out. I've been there and it's not a nice place.

   - Al Viro
Pages: 1 [2]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!