aliens

Author Topic: Effects of negative weapon power  (Read 3480 times)

Offline Harald_Gray

  • Colonel
  • ****
  • Posts: 142
    • View Profile
Effects of negative weapon power
« on: July 21, 2015, 10:48:23 pm »
Is there any chance somebody might wish to devote some time to rewrite the code that deals with effects of modding in negative weapon power?

I've created a stun weapon with negative power, my reasoning being that maybe this could create a long-range *unstunning* item. Honestly, I was expecting either no effect or a crash. Imagine my surprise when the shots became one-hit takedowns and the misses destroyed Skyranger walls.

I do realize this is a low-priority problem but the behavior is kind of weird.

Offline NuclearStudent

  • Captain
  • ***
  • Posts: 81
    • View Profile
Re: Effects of negative weapon power
« Reply #1 on: July 21, 2015, 11:53:20 pm »
I think it's an overflow problem or something. Like how the original Civ, setting aggressiveness to a negative number made the "Peaceful" Gandhi go nuts and kill everything.

Offline Yankes

  • Commander
  • *****
  • Posts: 3207
    • View Profile
Re: Effects of negative weapon power
« Reply #2 on: July 21, 2015, 11:56:05 pm »
No, negative power will would break/made more complex lot of code. Many times power is subtracted e.g. when you calculate explosion.
Proper way of doing something like this is alter how damage types affects units (e.g. instead `-1.0 * power` use `+1.0 * power`). And I already did this in my extended build. Weapon can heal/unstun/refresh time units/drain energy etc.

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
Re: Effects of negative weapon power
« Reply #3 on: July 21, 2015, 11:59:03 pm »
Can you target a "corpse" with that to bring back a stunned unit? Or would it have to be an explosion?

Offline yrizoud

  • Commander
  • *****
  • Posts: 1014
    • View Profile
Re: Effects of negative weapon power
« Reply #4 on: July 22, 2015, 12:09:38 am »
I checked in (an old copy of) the code and I don't see any miscast to unsigned. The yml parser supports negative numbers fine (clipSize -1), and the gameplay code almost never uses unsigned numbers.

Offline Yankes

  • Commander
  • *****
  • Posts: 3207
    • View Profile
Re: Effects of negative weapon power
« Reply #5 on: July 22, 2015, 01:15:19 am »
Can you target a "corpse" with that to bring back a stunned unit? Or would it have to be an explosion?
In extended version "corpses" don't have immunity. You can always finish them of... or heal if you can hit tile where they lay.

Offline ivandogovich

  • Commander
  • *****
  • Posts: 2381
  • X-Com Afficionado
    • View Profile
    • Ivan Dogovich Youtube
Re: Effects of negative weapon power
« Reply #6 on: July 22, 2015, 02:22:18 am »
Enter the "Genesis Device"  8)