Coder Social home page Coder Social logo

Comments (7)

SomeTroglodyte avatar SomeTroglodyte commented on July 20, 2024

Check #11701 middle commit (Edit: in a hurry, thus this terse)

from unciv.

SpacedOutChicken avatar SpacedOutChicken commented on July 20, 2024

Check #11701 middle commit (Edit: in a hurry, thus this terse)

I looked at the middle commit, and it doesn't look like it changes the code behind the unique. Am I missing something?

from unciv.

SomeTroglodyte avatar SomeTroglodyte commented on July 20, 2024

It shows there are two Uniques only differing in the case of the first letter... The commit only leaves a doc comment, because I noticed in passing. Confusing, so maybe the implementation got mixed up as well? ... Looking for code usages doesn't seem so at first glance. The one with capital C is CostsResources and has references around what the UniqueTargets say... I just mentioned that because I came across that Unique just lately and you now telling it doesn't work is a fishy coincidence.

from unciv.

SomeTroglodyte avatar SomeTroglodyte commented on July 20, 2024

Hmmm... First, ResourcesOverviewTab is more selective than WorldScreenTopBarResources in which resources to display. That should be unified. And EmpireOverviewCategories.Resources.showDisabled has still a slightly different selectivity - not good.

  • getConstructionButton gets a DTO for that Building "Check 2" without rejectionReason, even though there's 0 available 'Stuff' .
  • The breakpoint in INonPerpetualConstruction.requiredResources never hit before seeing that buy button enabled
  • The boolean functions in RejectionReason based on Collection.contains - did I not get rid of them? I distinctly remember moving them into flags on the RejectionReasonType... Even if done this way, they should be EnumSets not Set or even List. 'Cuz EnumSet.contains is a bitmask test and way faster than any other contains. Uh, but I only wanted to find the function producing them...
  • No, that's over my head. Can't find how that is even supposed to work. Seems all of the getResourceRequirements things don't apply...

from unciv.

SpacedOutChicken avatar SpacedOutChicken commented on July 20, 2024

For what it's worth, "<costs [amount] [stockpiledResource]>" works exactly as advertised, consuming the stockpiled resource when available and not allowing the action when there aren't enough resources. I've also been able to approximate the effect that I want by combining "Instantly consumes [positiveAmount] [stockpiledResource]" and "Only available <when above [amount] [stockpiledResource]>". The trouble remains that "Costs [amount] [stockpiledResource]" is still a dead letter.

from unciv.

SpacedOutChicken avatar SpacedOutChicken commented on July 20, 2024

@yairm210 The unique still appears to be a dead letter. It doesn't cause the amount of stockpiled resources to go down and it doesn't prevent the construction of units or buildings when there aren't enough stockpiled resources to go around.

from unciv.

SpacedOutChicken avatar SpacedOutChicken commented on July 20, 2024

I did a little more tinkering and found that the unique does work occasionally. Specifically, it kicks in when you try to build a unit without buying it. The cost will get subtracted as the unit is build, but not right when it's finished being built. It gets subtracted in the middle of the process, apparently one turn after the unit starts being built.

The cost can also prevent the unit from being built if you haven't got enough of the stockpiled resource, but it doesn't apply right away. Instead, what happens is that the game will let you start building the unit, and then will cancel the build after one turn. The possible unit will still appear on the menu, of course, but it never lets you finish constructing it.

All of this, unfortunately, can be circumvented by buying the unit or building. Purchase it with gold instead of production and the cost never gets subtracted at all.

It gets more interesting when you look at how this affects tile improvements. If a unit has the ability to instantly create a tile improvement that costs a stockpiled resource, it can't do so if there isn't enough resource to pay for it, but if it gets built, it doesn't cost anything. If you construct the tile improvement using a normal worker instead of a unit that makes the improvement instantly, the cost has no effect; the improvement can be constructed with or without the resource.

I don't know what's going on behind the scenes, but that's what I can tell you about what happens on the front end.

from unciv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.