• Home
  • Index
  • Search
  • Download
  • Server Rules
  • House Roleplay Laws
  • Player Utilities
  • Player Help
  • Forum Utilities
  • Returning Player?
  • Toggle Sidebar
Interactive Nav-Map
Tutorials
New Wiki
ID reference
Restart reference
Players Online
Player Activity
Faction Activity
Player Base Status
Discord Help Channel
DarkStat
Server public configs
POB Administration
Missing Powerplant
Stuck in Connecticut
Account Banned
Lost Ship/Account
POB Restoration
Disconnected
Member List
Forum Stats
Show Team
View New Posts
View Today's Posts
Calendar
Help
Archive Mode




Hi there Guest,  
Existing user?   Sign in    Create account
Login
Username:
Password: Lost Password?
 
  Discovery Gaming Community The Community Flood
« Previous 1 … 112 113 114 115 116 … 386 Next »
C# for all to disaprove of

Server Time (24h)

Players Online

Active Events - Scoreboard

Latest activity

C# for all to disaprove of
Offline Inferno
08-02-2016, 12:12 AM, (This post was last modified: 08-25-2016, 02:51 PM by Inferno.)
#1
[LN]
Posts: 949
Threads: 97
Joined: Apr 2016

So, I have this damage code for a small game I was working on awhile ago(it won't bear fruit, so I just tinker with the codes now) and I recently got a problem with it.

If(PlayerGetAttack){
If(ArmorThickness > ProjPen){
ImpDmg = (ProjImpDmg/ShieldStr);
PenDmg = (ProjPenDmg/(ShieldStr*4));
SlashDmg = (ProjSlashDmg/(ShieldStr*6)) ;
PlayerHP = OldPlayerHP - (ImpDmg+PenDmg+SlashDmg);
ArmorHP = OldArmorHP - ((ImpDmg+PenDmg+SlashDmg)/2);
OldPlayerHP = PlayerHP;
OldArmorHP = ArmorHP;
}
//What you saw above this comment is if the projectile is not powerful enough to penetrate the armor, the player will take very limited damage, as the armor took it up for him. Below is the codes for if the projectile goes THROUGH the armor.
If(ArmorThickness < ProjPen){
ImpDmg = (ProjImpDmg/ShieldStr);
PenDmg = (ProjPenDmg/(ShieldStr/3));
SlashDmg = (ProjSlashDmg/(ShieldStr/2)) ;
PlayerHP = OldPlayerHP - (ImpDmg+PenDmg+SlashDmg);
ArmorHP = OldArmorHP - ((ImpDmg+PenDmg+SlashDmg)*3);
OldPlayerHP = PlayerHP;
OldArmorHP = ArmorHP;
}
}

/*I recently added a new form of protection, shielding as we all know it. It takes up all damage, and Shields v1.0 took Impact damage the most, while Shields v2.0 introduced the shield types Positron, Gravaton, and Molecular, the latter being the closest to the original shield concept. Shields v2.0 also introduced three new damage types, Thermal against Molecular, Magnetic against Positron, and a third damage type I never gave a name to for Gravaton. Only problem is that instead of having six damage types, I now have 15 damage types and the majority of them do masses of damage to their respective shield. I seem to have lost the Shields v2.0 code, pity.

Anyway, take a look at the simple code overhead, and judge it for yourself. */


EDIT A:A request from one of my friends have yeilded a slightly different code, focused on small % reductions and a flat dmg reduction, meaning if you have '10' armor and you take 25 damage, the armor takes up ten of the 25 and then a percentage of the remaining 15, and you take the rest. ArmorHP may or may not be a factor in this matter.

If(PlayerGetAttack){
DMG = (AttackDMG/ArmorDMG) - ArmorSTR; //a single number, or we multiply it by a percentage, should he resuest otherwise. ArmorDMG will represent % reduction and ArmorSTR will represent flat reduction.
PlayerHP = OldPlayerHP - DMG;
OldPlayerHP = PlayerHP;
}


Now, without the complex Pen/Slash/Imp damages, we get a smaller code overall. It isnt as pleasing to code in, due to the lack of complexity(somehow I feel that the more conplex the code the more fun it is. Strange right?)
Reply  


Messages In This Thread
C# for all to disaprove of - by Inferno - 08-02-2016, 12:12 AM
RE: C# for all to disaprove of - by Sturmwind - 08-02-2016, 06:55 AM
RE: C# for all to disaprove of - by Sorrontis - 08-02-2016, 03:59 PM
RE: C# for all to disaprove of - by Inferno - 08-25-2016, 02:58 PM
RE: C# for all to disaprove of - by Thyrzul - 08-26-2016, 12:37 AM
RE: C# for all to disaprove of - by Arioch - 08-26-2016, 01:44 AM
RE: C# for all to disaprove of - by Thyrzul - 08-26-2016, 01:46 AM
RE: C# for all to disaprove of - by Remnant - 08-26-2016, 02:04 AM
RE: C# for all to disaprove of - by Inferno - 08-26-2016, 05:28 AM
RE: C# for all to disaprove of - by Corile - 08-26-2016, 12:03 PM

  • View a Printable Version
  • Subscribe to this thread


Users browsing this thread:
1 Guest(s)



Powered By MyBB, © 2002-2025 MyBB Group. Theme © 2014 iAndrew & DiscoveryGC
  • Contact Us
  •  Lite mode
Linear Mode
Threaded Mode