It is currently 20 Apr 2024, 00:01
   
Text Size

Gold Cost Formula

MicroProse's Shandalar Campaign Game, now with new cards & a new look!

Moderators: BAgate, drool66, Aswan jaguar, gmzombie, stassy, CCGHQ Admins

Re: Gold Cost Formula

Postby Korath » 22 Apr 2016, 00:52

Just because a column has a human-readable label doesn't mean that's what it actually does. Many of them were very poorly understood when the names were assigned, and some of them are flat wrong.

Legendary cards can also have Family 15 (primarily for non-creatures).

Flags: Act Use X doesn't do anything except, when displaying the "AI player activates such-and-such a card" dialog, show the value picked for X in an activated ability that has X is in the cost. By design, it's not on every activated ability with X in the cost, and is on some that don't have X in the cost but do have some other variable that should be shown in that dialog.

Flags: Counters is entirely unused in Shandalar, and does something mostly unrelated to counters (it's not entirely clear what) in Manalink. It's not set on any non-Manalink cards, and only very inconsistently on the Manalink ones.

Flags: Activated Counterspell doesn't mean "this card has an activated ability that counters a spell"; it happened to be on several of the original cards that had such abilities. It controls, to some extent and in combination with Flags: Activated Interrupt and Flags: Protect, whether the card can be activated during the interrupt window or during the regeneration or damage prevention steps. It's unused in Shandalar, and not set on any non-Manalink cards (and inconsistently on the Manalink ones).

Flags: Paid Mana Source doesn't do anything except make it so a card can never be autotapped for mana. It's currently on only four cards in the Shandalar pool (Apprentice Wizard, Celestial Prism, Coal Golem, and Fire Sprites); I'm likely going to repurpose it to indicate mana filters.

Flags: Lich didn't really have anything to do specifically with Lich. If no card with that flag set was on the battlefield during a given turn, then triggers for gaining or losing life and for replacing life gain or loss aren't sent. If set on a specific card, that card will also get EVENT_SPECULATIVE_LIFE events, which tell the AI to use a card-specific value instead of a player's current life when evaluating the current game state (e.g. Lich, when it gets rewritten, will use this event to tell the AI to value each controlled permanent as a point of life and ignore that its current life total is 0); it's currently only used this way by Transcendence, Lich's Tomb, and Phyrexian Unlife.

Flags: Force Attack doesn't do anything at all. It was originally checked before dispatching the also-badly-named EVENT_MUST_ATTACK immediately before combat; while it's true that cards with "[cardname] attacks each turn if able" responded to that event in the obvious way, so do the cards with "at the start of combat, ..." and other similarly-timed effects. Forgetting to set that bit on a card that needs it was so common in Manalink, and dispatching the single EVENT_MUST_ATTACK event is so cheap, that we eventually just removed the check for the bit.

Rarity is canonically set in the individual sets' columns in Manalink.csv.

Reporting "clearly-wrong" csv values should be done in the Manalink CSV errors thread, in general. Some of these sorts of problems are fixed at runtime in Shandalar; see DeclareCardFunction::assign_to_cards_data() in src/shandalar/replace_cards.cpp, starting at "// Fix bad card data". (That's the right place to report even if it's a Shandalar-only card, since the expectation is that they'll eventually go into Manalink as well. (You can mostly tell because the "CODED CARD" column in Manalink.csv will be 0, though the backs of double-faced cards, bottoms of flip cards, and animated versions of manlands and so on will also be set to 0.))
User avatar
Korath
DEVELOPER
 
Posts: 3707
Joined: 02 Jun 2013, 05:57
Has thanked: 496 times
Been thanked: 1106 times

Re: Gold Cost Formula

Postby Rawky » 22 Apr 2016, 04:48

I updated the previous list of fields to reflect the above limitations.

I also finalized one (the lesser) of the two halves of the value formula, shown previously as the converted mana cost value (cmcv). In this new form, I am attempting to give value to the less prohibitive nature of generic mana in a given casting cost. Later, I will offset some of this benefit by reducing the value of creatures with increased destructibility (artifact, enchantment).
Code: Select all
int ccv = (
            (100 -
              (
                (
                  (
                    (
                      (7/6) * cd->cc[1]
                    ) / 2
                  ) + cd->cc[0] + 1
                ) * 5
              )
            ) / 100
          )

or

int ccv = ((100-(((((7/6)*cd->cc[1])/2)+cd->cc[0]+1)*5))/100)
cd->cc[0] = ColoredCost
cd->cc[1] = ColorlessCost
ccv yields a value between 0.95 (Ornithopter) and 0.48 (Draco)
Obviously, I can't use int as the data type unless I move the decimal over a few places. Otherwise, I'll just get zero every time.

Basically, a creature with any amount of generic mana in the cost will go up in price, relative to how much generic mana is in the cost (Metallic Sliver sees no significant change, whereas Serra Angel goes up 15g, and Draco would triple in price). Anything with only colored mana in the casting cost (Black Knight, Progenitus) will not be affected at all. This invalidates much of the previous sample list. It's a way to assign value to that which is otherwise mostly immeasurable (ie. high casting cost artifact creatures, eldrazi, and other nefarious monsters that come with unique and powerful abilities). It will fail to add any price barrier to creatures with specific color requirements in their cost, but that in itself is prohibitive to the player taking limitless advantage of what the card provides.

Thus, in the ultra-simplified (A x B) formula, the above is the A. B will be tackled next, but it's already mostly done in pseudo code.
Last edited by Rawky on 23 Apr 2016, 22:29, edited 7 times in total.
Rawky
 
Posts: 106
Joined: 09 Oct 2015, 02:40
Has thanked: 25 times
Been thanked: 31 times

Re: Gold Cost Formula

Postby stassy » 22 Apr 2016, 06:00

Rawky wrote:I thought that being able to see all the Creature Rating Mod values would help me to understand its purpose. I am now even more confused by its existence.
The AI base value is an arbitrary value set on every card manually by me and only used for Draft mode in Manalink (this will tell what the AI should prioritize when drafting).
Originally it was sought to help the AI decide which card was worth during a Manalink duel when it was discovered, but unfortunately after several tests it wasn't.

Explantation and rank of the AI base value can be found here :
viewtopic.php?f=56&t=8991
stassy
Moderator
 
Posts: 5274
Joined: 25 Feb 2009, 07:06
Has thanked: 471 times
Been thanked: 337 times

Re: Gold Cost Formula

Postby Rawky » 23 Apr 2016, 22:27

I just noticed that the only data types that I am seeing so far in replace_function.cpp are bool, char, int, and void.

Is this consistent throughout the whole program?

Can I use float and later convert the calculation result to int?

If not, I'll just work with bigger numbers and reduce them at the end.
Rawky
 
Posts: 106
Joined: 09 Oct 2015, 02:40
Has thanked: 25 times
Been thanked: 31 times

Re: Gold Cost Formula

Postby Korath » 23 Apr 2016, 23:11

The engine expects to get an int at the end. (Floating-point, fractional, imaginary, etc. gold doesn't make such sense, after all.) Doesn't matter how you get there.
User avatar
Korath
DEVELOPER
 
Posts: 3707
Joined: 02 Jun 2013, 05:57
Has thanked: 496 times
Been thanked: 1106 times

Re: Gold Cost Formula

Postby Rawky » 24 Apr 2016, 19:59

What about changing line 55085 in exe_shandalar.c

Currently it is this:
Code: Select all
Gold += v19;
Perhaps change it to something like this:
Code: Select all
Gold += v19/10;
So you only get 10% of the value when sold. Seems like a simpler solution for now.

Edit: Actually, that wouldn't inform the player.

Changing line 55071 makes more sense.
Code: Select all
v19 = SellPrice(v20)/10; //sales nerfed to 10% on (date)
That would stop the piles of gold issue for now and a redo of the price formula can be added later.
Rawky
 
Posts: 106
Joined: 09 Oct 2015, 02:40
Has thanked: 25 times
Been thanked: 31 times

Previous

Return to Shandalar

Who is online

Users browsing this forum: No registered users and 50 guests


Who is online

In total there are 50 users online :: 0 registered, 0 hidden and 50 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 50 guests

Login Form